This allows to store, query, and manipulate geographical locations(latitude, longitude) efficiently.
- Finding nearby locations (e.g., nearest stores, ATMs)
- Calculating distances between two points
- Sorting locations by proximity
# Add Locations
# GEOADD <Key> <latitude> <longitude> <location_name>
GEOADD stores 13.4105 52.5244 "Berlin"
GEOADD stores 12.4964 41.9028 "Rome"
GEOADD stores -0.1276 51.5074 "London"# Retriving locations
GEOPOS stores "Berlin"# Calculate Distance
GEODIST stores "Berlin" "London" km# Sorting Locations by Distance
# `ASC` → Sorts results by closest distance first.
# `DESC` → Sorts results by farthest distance first.
GEOSEARCH stores FROMLONLAT 13.4105 52.5244 BYRADIUS 500 km ASC# `GEOHASH` converts the location into a **geohash** (a compact string representation).
GEOHASH stores "Berlin"Info
Geohashing is a geocoding system that encodes geographic coordinates (latitude and longitude) into short, alphanumeric strings, allowing for the representation and sharing of locations in a concise and easily understandable format