地理标记文字和点之间的PostGIS ST_距离差异
地理标记文字和点之间的PostGIS ST_距离差异,postgis,Postgis,t.coords=“{44.18711,-115.83225}”和t2.coords=“{54.18711,-105.83225}” d1返回为1326899.86792105,d2返回为14.142135623731 为什么呢?谢谢 似乎我必须将ST_Point转换为地理类型,然后它才能工作。似乎我必须将ST_Point转换为地理类型,然后它才能工作 SELECT t.coords, t2.coords, ST_Distance(ST_GeogFromText('SRID=4326;POI
t.coords=“{44.18711,-115.83225}”
和t2.coords=“{54.18711,-105.83225}”
d1
返回为1326899.86792105
,d2
返回为14.142135623731
为什么呢?谢谢 似乎我必须将
ST_Point
转换为地理类型,然后它才能工作。似乎我必须将ST_Point
转换为地理类型,然后它才能工作
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;