Redis geospatial

Introduction to the Redis Geospatial data type

Redis geospatial indexes let you store coordinates and search for them. This data structure is useful for finding nearby points within a given radius or bounding box.

Note:
Take care not to confuse the Geospatial data type with the Geospatial features in Redis Query Engine. Although there are some similarities between these two features, the data type is intended for simpler use cases and doesn't have the range of format options and queries available in Redis Query Engine.

Basic commands

  • GEOADD adds a location to a given geospatial index (note that longitude comes before latitude with this command).
  • GEOSEARCH returns locations with a given radius or a bounding box.

See the complete list of geospatial index commands.

Examples

Suppose you're building a mobile app that lets you find all of the bike rental stations closest to your current location.

Add several locations to a geospatial index:

Find all locations within a 5 kilometer radius of a given location, and return the distance to each location:

Learn more

RATE THIS PAGE
Back to top ↑