当前位置:网站首页>Redis6 new data type geospatial
Redis6 new data type geospatial
2022-07-19 08:27:00 【Illusory clarity】
1. brief introduction
Redis 3.2 Added right to GEO Type of support .GEO,Geographic, Abbreviation for geographic information . This type of , Is the two-dimensional coordinates of the element , On the map is latitude and longitude .redis Based on this type , Longitude and latitude settings are provided , Inquire about , Range queries , Distance inquiry , Longitude and latitude Hash And so on .
2. command
1、geoadd
(1) Format
geoadd<key>< longitude><latitude><member> [longitude latitude member...] add Plus location ( longitude , latitude , name )

(2) example
geoadd china:city 121.47 31.23 shanghai
geoadd china:city 106.50 29.53 chongqing 114.05 22.52 shenzhen 116.38 39.90 beijing

Be careful :
1、 Two poles can't be added directly , City data is usually downloaded , Directly through Java The program is imported once .
2、 Effective longitude from -180 C to 180 degree . Effective latitude from -85.05112878 C to 85.05112878 degree .
3、 When the coordinate position is beyond the specified range , The command will return an error .
4、 Added data , You can't add it again .
2、geopos
(1) Format geopos <key><member> [member...] Get the coordinate value of the specified area 
(2) example 
3、geodist
(1) Format geodist<key><member1><member2> [m|km|ft|mi ] Get the linear distance between two positions .
Company :
m Expressed in meters [ The default value is ].
km Expressed in kilometers .
mi In miles .
ft In feet .
If the user does not explicitly specify the unit parameter , that GEODIST The default is meters 
(2) example
Get the linear distance between two positions 
4、georadius
(1) Format georadius<key>< longitude><latitude>radius m|km|ft|mi Centered on a given latitude and longitude , Find the elements in a certain radius .
longitude: longitude
latitude: latitude
radius: distance
m|km|ft|m: Company 
(2) example 
边栏推荐
猜你喜欢

Array exercise 3

Talk about distributed locks

1、决策树

QT related problems encountered when writing code

才意识到自己“奇葩”的360,会不会有些晚?

60、wsgiref手写web框架+jinja2模块初识

Redis常用数据类型——哈希(Hash)和有序集合 Zset(sorted set)

Visual studio production environment configuration scheme: slowcheetah

leetcode:287. 寻找重复数【快慢指针板子】

Demo collection injection
随机推荐
Classic general pbootcms flower website template source code, adaptive mobile terminal, with background management
Textview text up and down
Use of OpenCV polar transformation function warppolar
Redis6新数据类型——HyperLogLog
Super dry! Thoroughly understand golang memory management and garbage collection
Visual studio production environment configuration scheme: slowcheetah
49、Mysql使用
JS学习笔记06-08:数组的遍历以及数组的四个方法
SPARK中的FileSourceStrategy,DataSourceStrategy以及DataSourceV2Strategy
5G正当时,无人驾驶未来将驶向何方?
Gateway新一代网关
1. Flask Foundation
Viewing the technology stack of distributed system from the crash report of station B
Application of SCA on devsecops platform
Redis 概述安装
Openpyxl copy sheet pages across workbooks
全志V3s学习记录(13)OV2640的使用
ansible自动化运维详解(四)ansible中playbook的编写使用、执行命令及实例演示
812. 最大三角形面积
5.2 database security