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

How do you find all stored locations within a certain radius of a specific point using Redis?

Intermediate

Answer

You use the GEOSEARCH command, specifying a center point either by coordinates or by an existing member's name, along with a radius and unit, and Redis returns all members within that stored dataset that fall within the specified distance from the center point.
GEOSEARCH locations FROMMEMBER 'San Francisco' BYRADIUS 500 km ASC
Real-world example A ride sharing application finds all available drivers within a five kilometer radius of a customer's pickup location using GEOSEARCH, quickly identifying the nearest available options.

Common follow-ups: What is the difference between searching from a member versus searching from specific coordinates?;Can GEOSEARCH also search within a rectangular area instead of a radius?