Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the geolocation support of Redis

Shulou Source: shulou.com Published: 2022-06-03 05:32:03 09月30日 Update

This article introduces you what the geographic location support of Redis is, and the content is very detailed. Interested friends can refer to it and hope to be helpful to you.

The biggest feature added in the redis3.2 version is support for GEO (geolocation)

The map aspect of the current business is to call Gaud api (cloud map). There will be some delay in the request, while redsigeo can find the nearby terminal and measure the straight line distance between the two points (with error).

1. Geoadd: increase the coordinates of a geographical location.

2. Geopos: get the coordinates of a geographical location.

3. Geodist: get the distance between two geographical locations.

4. Georadius: get the collection of geographic locations within the specified range according to the given geographic location coordinates.

5. Georadiusbymember: get a collection of geographic locations within a specified range according to a given geographic location.

6. Geohash: get the geohash value of a geographic location.

Geoadd

Geoadd is used to increase the coordinates of geographic locations. You can add geographic locations in batches. The command format is as follows:

GEOADDkeylongitudelatitudemember [longitudelatitudemember...]

Key identifies a collection of geographic locations. Longitudelatitudemember identifies the coordinates of a geographic location. Longitude is the longitude of a geographical location, and latitude is the latitude of a geographical location. Member is the name of the geographic location. GEOADD can add a batch of geolocations to the collection in bulk.

Geopos

Geopos can obtain the coordinates of geographical locations, and can obtain the coordinates of multiple geographical locations in batches. The command format is as follows:

GEOPOSkeymember [member...]

Geodist

Geodist is used to obtain the distance between two geographic locations. The command format is as follows:

GEODISTkeymember1member2 [m | km | ft | mi]

Units can be specified in the following four types:

M: meters, the default distance unit is meters, if you do not pass this parameter, the unit is meters.

Km: km.

Mi: miles.

Ft: feet.

About how the geographic location support of Redis is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Location geography geographic location coordinates support unit command format two content more logo scope help yes maximum business between cloud map interest Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MySQL vpn Linux Shulou Technology