Redis GEO – Commands to manage a geospatial value in redis datastore

5 years ago Lalit Bhagtani 0

Geospatial value contains longitude and latitude coordinates of a particular location on earth, In Redis, geospatial elements can be store in a sorted set value stored at a key and various redis commands are used to store, manage and retrieved a geospatial value stored in redis database. The syntax for using redis geo commands is as follows :-

Syntax :-

redis host:post> <Command Name> <key name>

Example :-

Redis GEO

Redis GEO Value Commands :- 

Some of the important commands to manage geospatial value in redis database are as follows :-

S.No Command Description
1 GEOADD Add one or more elements in geospatial value
2 GEORADIUS Return elements that comes inside an area defined by given position
3 GEORADIUSBYMEMBER Removes elements that comes inside an area defined by given member of geospatial value
4 GEODIST Returns distance between two members of geospatial value
5 GEOHASH Returns Geohash value of one or more members of geospatial value
6 GEOPOS Returns position of one or more members of geospatial value

 

References :-

  1. GEO Command Docs

That’s all for Redis geospatial value and commands used to store and manage it in redis datastore. If you liked it, please share your thoughts in comments section and share it with others too.