Redis › Geospatial Data in Redis
How do you find the distance between two stored locations in Redis?
BeginnerAnswer
You use the GEODIST command, specifying the two member names whose distance you want to calculate along with an optional unit like meters, kilometers, or miles, and Redis returns the calculated distance between those two points based on their stored geographic coordinates.
GEODIST locations 'San Francisco' 'New York' kmReal-world example A travel planning application calculates the distance between two cities a user has selected, using GEODIST to instantly return the distance in kilometers without needing a separate geographic calculation service.