Skip to content

Geo查询

iamazy edited this page Oct 14, 2019 · 6 revisions

目前支持的Geo查询

geo_bounding_box
geo_distance
geo_polygon
geo_shape
geojson_shape

示例

select * from student where location.coordinate between [30,70] and [20,50]   --geo_bounding_box
select * from student where location.coordinate in [[30.132,50],[40,60],[50,212]]  --geo_polygon
select * from student where location.coordinate=[40,30] and distance='100km'  --geo_distance

--geo_shape
-- 语法: where [field] [relation] [coordinates] shaped as [shape]
select * from student where location.coordinate within [[10,10],[20,20]] shaped as envelope
select * from student where location.coordinate contains [[[10,10],[20,20]],[[11,11],[21,21]]] shaped as multilinestring
select * from student where location.coordinate disjoint [[[[10,10],[20,20],[11,11],[21,21]]],[[[10,10],[20,20],[11,11],[21,21]]]] shaped as multipolygon

--geo_shape query by geojson
select * from student where location.coordinate disjoint `{"coordinates": [[-155.52, 19.61], [-156.22, 20.74], [-157.97, 21.46]], "type": "MultiPoint"}`
Clone this wiki locally