Back to results for “Set”
Redis › Geospatial Data in Redis

What geospatial capabilities does Redis provide, and what commands are used to add location data?

Beginner

Answer

Redis lets you store geographic coordinates, meaning longitude and latitude, associated with a member name using the GEOADD command, which internally stores this location data using a sorted set, allowing you to later perform location based queries like finding nearby points or calculating distances.
GEOADD locations -122.4194 37.7749 'San Francisco'
GEOADD locations -73.9857 40.7484 'New York'
Real-world example A delivery tracking application stores the current location of each delivery driver using GEOADD, updating their coordinates as they move throughout the day.

Common follow-ups: What data structure does Redis actually use internally to store geospatial data?;Can you update an existing member's location using GEOADD again?