Day3, Redis geographic location, cardinality statistics, detailed use of bitmap scenarios

gaospatial geographic information

City latitude and longitude query

* Add one or more geolocation coordinates

GEOADD key longitude latitude member [longitude latitude member ...]

The key is the index of the geographic location.
longitude represents the longitude of the location.
latitude represents the latitude of the location.
Member represents the place name
[longitude latitude member …] which can be added repeatedly, separated by spaces.

Query the coordinates of one or more locations (can only query previously added ones)

geopos key member

Find the distance between two places

getdist key member1 member2

(You can add units after, m is meters, km kilometers, ft feet, mi miles, you can not write the default is meters)

** Search for geographic location with coordinates as the center**

georadius key  longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST][WITHHASH] [COUNT count] [ASC|DESC]

Optional parameters:
[WITHCOORD], indicating whether to output the latitude and longitude
[WITHDIST], indicating whether to output the distance
[WITHHASH], indicating whether to output the hash value
[COUNT count], indicating that several data are output
[ASC|DESC], indicating that the distance is in ascending order Or descending order, ASC ascending order, DESC descending order
The query will only find the added position coordinates

Location-centric search for geographic locations

georadiusbymember ...

(The parameters are the same as the above coordinates as the center)

Hyperloglog cardinality statistics

Cardinality calculation: the number of data in a set of data after removing duplicate elements

Create a set of data

pfadd key element

Statistical base

pfcount key

Merge datasets

pfmerge destkey sourcekey

destkey is the name of the
dataset to be merged into sourcekey is the name of the dataset to be merged, there can be multiple, separated by spaces

Bitmap Bitmap

Input bitmap dataset

setbit key offset value

key is the index of the data set
offset is the subscript of the data
to be input value is the data to be input, 0 or 1

count the number of 1

bitcount key [start end]

start end is the starting subscript of the query, without writing all the data in the default statistical data set

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324147574&siteId=291194637