Redis › Geospatial Data in Redis
How would you design a real time location tracking system for a fleet of delivery vehicles using Redis geospatial commands?
AdvancedAnswer
You would use GEOADD to continuously update each vehicle's current location as it moves, use GEOSEARCH to find the nearest available vehicles to a new delivery request, and combine this with an expiration or a separate timestamp field to detect vehicles that have stopped reporting their location, ensuring stale positions do not affect dispatch decisions.
GEOADD fleet -122.4194 37.7749 'truck5'
GEOSEARCH fleet FROMLONLAT -122.42 37.77 BYRADIUS 10 km ASC COUNT 5Real-world example A logistics company builds a real time dispatch system that continuously updates each truck's location and instantly finds the five nearest available trucks whenever a new delivery request comes in, using Redis geospatial commands for fast, accurate matching.