【问题标题】:PostGIS ST_Distance discrepancy between GeogFromText and PointGeogFromText 和 Point 之间的 PostGIS ST_Distance 差异
【发布时间】:2016-06-11 20:48:25
【问题描述】:
SELECT t.coords, t2.coords,
  ST_Distance(ST_GeogFromText('SRID=4326;POINT(-115.83225 44.18711)'), ST_GeogFromText('SRID=4326;POINT(-105.83225 54.18711)')) AS d1,
  ST_Distance(ST_Point(t.coords[2], t.coords[1]), ST_Point(t2.coords[2], t2.coords[1])) AS d2
FROM locations
INNER JOIN locations t2 ON t2.id = 1
WHERE t.id = 2;

t.coords = "{44.18711,-115.83225}"t2.coords = "{54.18711,-105.83225}"

d1 返回为 1326899.86792105d2 返回为 14.142135623731

这是为什么呢?谢谢!

【问题讨论】:

    标签: postgis


    【解决方案1】:

    似乎我必须将ST_Point 转换为geography 类型,然后才能正常工作。

    【讨论】:

      猜你喜欢
      • 2011-09-11
      • 1970-01-01
      • 2014-04-12
      • 1970-01-01
      • 2020-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-13
      相关资源
      最近更新 更多