找到圆心 POINT(1000 1000) 100米范围内的查询如下:
SELECT * FROM geotable
WHERE ST_DWithin(geocolumn, ‘POINT(1000 1000)’, 100.0);
又或者你需要的是矩形检索:ST_MakeBox2D(geometry pointLowLeft, geometry pointUpRight);
SELECT feature_id, feature_name, the_geom
FROM features
WHERE the_geom && ST_SetSRID(ST_MakeBox2D(ST_Point(-989502.1875, 528439.5625),
ST_Point(-987121.375 ,529933.1875)),2163)
以下是详细的解释:
在地图中一个任意经,纬度下点击.想要找到以这个点为中心指定半径下包含多少个兴趣点.
查看postgis手册找到了这么一个函数(ST_Distance(geometry g1, geometry g2);)
官方文档上是这么说的:
ST_Distance — For