GEOSEARCH nearest query
GEOSEARCH retrieves GEO members located within a specified geographic area or distance from a search center. In this course, FROMLONLAT and BYRADIUS define the restaurant's location and search radius, while ASC and COUNT return a limited number of nearest riders in distance order.
Minimal example
locations, err := rdb.GeoSearchLocation(ctx, "riders:geo",
&redis.GeoSearchLocation{
Longitude: 77.5946, Latitude: 12.9716,
Radius: 3, RadiusUnit: "km",
Sort: "ASC", Count: 10,
},
).Result()Learn this concept
Lesson 5.6 · Redis GEO and SET NX PXUsed in exercises
Exercise 5.7 · Rider presence service Exercise 5.8 · Rider assignment workerPrerequisite conceptsRedis GEO