美文网首页
postgis查询输入坐标周边n米范围内的记录

postgis查询输入坐标周边n米范围内的记录

作者: 铭净止水 | 来源:发表于2018-11-24 18:49 被阅读0次

    8000多记录一二百毫秒就能出结果:

    select *,st_distance(ST_GeomFromText('POINT(119.383341323 36.8461558610001)',4326),t.geom,true) closestdistance,st_asgeojson(t.geom) geo from line t where ST_DWithin(ST_GeomFromText('POINT(119.383341323 36.8461558610001)',4326)::geography,t.geom::geography,100)

    主要是ST_DWithin快,比创建缓冲区再判断叠加关系快得多

    相关文章

      网友评论

          本文标题:postgis查询输入坐标周边n米范围内的记录

          本文链接:https://www.haomeiwen.com/subject/ieoifqtx.html