加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – postgis st_distance返回不正确的结果

发布时间:2020-12-13 15:51:07 所属栏目:百科 来源:网络整理
导读:我使用postgis来计算2个地理坐标之间的距离. select st_distance( 'POINT(15.651955 73.712769)'::geography,'POINT(14.806993 74.131451)'::geography) AS d; 它返回我53536.743496517米,大约等于54km,但实际距离是103km,我通过http://boulter.com/gps/dist
我使用postgis来计算2个地理坐标之间的距离.

select st_distance(
  'POINT(15.651955 73.712769)'::geography,'POINT(14.806993 74.131451)'::geography) AS d;

它返回我53536.743496517米,大约等于54km,但实际距离是103km,我通过http://boulter.com/gps/distance/计算

我在查询中做错了吗?

解决方法

POINT()在经度,纬度中获取其参数.交换你的论点.

select st_distance(
  'POINT(73.712769 15.651955)'::geography,'POINT(74.131451 14.806993)'::geography) AS d;

st_distance
--
103753.197677054

我经常犯这个错误,因为我认为在纬度和经度方面,而不是经度和纬度.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读