In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Proper noun
Geographic geography
Radius radius range; radius (distance); circular area measured by radius
Redis GEO implementation
The redis GEO implementation mainly includes the following two technologies:
1. Use geohash to save the coordinates of the geographic location.
2. Use ordered sets (sort set) to save geographically located collections. (emphasis: sort set-based storage)
Redis GEO method list
Geoadd
Meaning:
Adds the specified geospatial location (latitude, longitude, name) to the specified key.
Syntax:
GEOADD key longitude latitude member [longitude latitude member]
Achieve:
Geoadd city_clusters 116.405285 39.904989 beijing 121.472644 31.231706 shanghaigeopos
Meaning:
Returns the position (longitude and latitude) of all given location elements from the key
Syntax:
GEOPOS key member [member...]
Achieve:
1) "116.40528291463851929" 2) "39.9049884229125027" 2) "121.47264629602432251" 2) "31.23170490709807012" geodist
Meaning:
Returns the distance between two given positions.
Note:
The parameter unit for the specified unit must be one of the following units:
M represents the unit in meters.
Km means the unit is kilometer.
Mi stands for miles.
Ft means the unit is feet.
If the user does not explicitly specify the unit parameter, GEODIST defaults to meters.
Syntax:
GEODIST key member1 member2 [unit]
Achieve:
127.0.0.1 geodist city_clusters beijing shanghai km 6379 > geodist city_clusters beijing shanghai "1067597.9668" geohash
Meaning:
Returns the Geohash representation of one or more location elements.
Function: convert two-dimensional latitude and longitude into a string.
Syntax:
GEOHASH key member [member...]
Achieve:
127.0.0.1 geohash city_clusters beijing1) "wx4g0b7xrt0" 127.0.0.1 geohash city_clusters beijing shanghai1) "wx4g0b7xrt0" 2) "wtw3sjt9vg0" georadius
Meaning:
With a given latitude and longitude as the center, the return key contains all location elements whose distance from the center does not exceed the given maximum distance.
Note:
The range can use one of the following units:
M represents the unit in meters.
Km means the unit is kilometer.
Mi stands for miles.
Ft means the unit is feet.
The command returns additional information when given the following options:
WITHDIST: returns the distance between the location element and the center as well as the location element. The unit of distance is consistent with the range unit given by the user.
WITHCOORD: returns the longitude and dimension of the location element as well.
WITHHASH: returns the ordered set score of the position element encoded by the original geohash as a 52-bit signed integer. This option is mainly used for underlying applications or debugging, but it is not very useful in practice.
COUNT limits the number of records returned
The command returns unsorted location elements by default. The user can specify how the elements of the returned location are sorted with the following two parameters:
ASC: returns the location element from near to far, depending on the location of the center.
DESC: returns the location element from far to near, depending on the location of the center.
Syntax:
GEORADIUS key longitude latitude radius m | km | ft | mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC | DESC] [STORE key] [STOREDIST key]
Achieve:
Georadius city_clusters 114.546569 30.496705 1000 km withdist withcoord withhash count 3 asc 1) 1) "wuhan" 2) "0.0002" 3) (integer) 4051940381831537 4) 1) "114.54657107591629028" 2) "30.49670420836107354" 2) "ezhou" 2) "34.4580" 3) (integer) 4051965036178493 4) 1) "114.88938957452774048" 2) "30.40377626121739496" 3) "shanghai" 2) "666.1872" 3) (integer) 4054803464817068 4) 1) "121.47264629602432251" 2) "31.23170490709807012georadiusbymember
Meaning:
Like the GEORADIUS command, you can find elements within a specified range, but the center point of GEORADIUSBYMEMBER is determined by a given location element, rather than using the longitude and latitude entered by GEORADIUS to determine the center point.
Note:
Same as georadius
Syntax:
GEORADIUSBYMEMBER key member radius m | km | ft | mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count]
Achieve:
Georadiusbymember city_clusters ezhou 1000 km withcoord withdist withhash count 10 asc1) 1) "ezhou" 2) "0.0000" 3) (integer) 4051965036178493 4) 1) "114.88938957452774048" 2) "30.40377626121739496" 2) "wuhan" 2) "34.4578" 3) (integer) 4051940381831537 4) 1) "114.5465710759162928" 2) "30.49670420836107354" 3) "shanghai" 2) . 4470 "3) (integer) 4054803464817068 4) 1)" 121.47264629602432251 "2)" 31.23170490709807012 "
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.