【问题标题】:postgis st_distance returning incorrect resultspostgis st_distance 返回不正确的结果
【发布时间】:2013-02-16 19:15:03
【问题描述】:

我正在使用 postgis 计算 2 个地理坐标之间的距离。

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

返回给我的是 53536.743496517 米,大约等于 54 公里,但我通过http://boulter.com/gps/distance/ 计算得出的实际距离是 103 公里

我在查询中做错了吗?

【问题讨论】:

    标签: postgresql postgis postgresql-9.1


    【解决方案1】:

    POINT() 以经度、纬度为参数。交换你的论点。

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

    我经常犯这个错误,因为我考虑的是经纬度,而不是经度和纬度。

    【讨论】:

      猜你喜欢
      • 2023-03-25
      • 2020-06-23
      • 2011-09-11
      • 2012-04-11
      • 2016-02-06
      • 2017-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多