Redis › Geospatial Data in Redis
What geospatial capabilities does Redis provide, and what commands are used to add location data?
BeginnerAnswer
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.