Does DynamoDB support geospatial queries?

Not natively. DynamoDB has no geospatial data type and no distance or bounding-box operators. Geospatial queries are a modeling pattern instead: store a geohash or S2 cell ID in the key so nearby points sort together, query the cells covering your search area, then refine by exact distance in your application.

The geohash pattern

A geohash (or an S2 cell ID, as used by AWS's Geo Library for DynamoDB) encodes latitude/longitude into a string or number whose prefix identifies a grid cell — and crucially, nearby points share prefixes. Stored as a partition or sort key, that turns "points near me" into ordinary key-range queries:

  • Box query — compute the cells covering a rectangle, Query each cell, merge the results.
  • Radius query — same, over the cells covering a circle, then filter by exact distance client-side.

Resolution matters: pick a cell size where most searches touch only the target cell and its neighbors.

Libraries and tooling

AWS published the Geo Library for Amazon DynamoDB (Java) demonstrating the S2-based pattern, and community ports exist for other languages (such as dynamodb-geo for Node.js). Check maintenance status before adopting one — the pattern itself is simple enough to implement directly.

When to use a search engine instead

For rich geo predicates (polygons, sorting by distance, combining geo with full-text), replicate the table into a purpose-built index — the same zero-ETL OpenSearch integration that handles full-text search also gives you a search engine with native geospatial queries. DynamoDB vs Elasticsearch weighs that database-plus-index split in full.

Go deeper

The pattern is a sort-key trick at heart — the sort key strategies guide covers the toolbox, the expression builder generates the begins_with/BETWEEN conditions cell queries use, and DynoTable lets you inspect the encoded keys on your real items.

References

Last verified 2026-07-13 against the official AWS documentation linked above.

Work with DynamoDB without the Console

DynoTable is a fast desktop client for DynamoDB — browse tables, run SQL-style queries, and edit items locally.