PostGIS -ST_SHORTESTLINE与LAT LON不正确
我正在使用PostGis st_shortestline来计算一条线和点之间的最短线(一些米):
SELECT ST_AsText(
ST_ShortestLine(ST_GeomFromText('POINT(2.33123610021 48.87902639841)', 4326),
ST_GeomFromText('LINESTRING ( 2.33122725689 48.87902421718, 2.33123229444 48.87901190847)', 4326))
) As sline;
我得到的结果似乎不连贯,给定的行不是最短的线:
LINESTRING(2.33123610021 48.87902639841,2.331227760998549 48.87902298544515)
这是一幅图纸结果,使用Mercator投影(JOSM)。
可以解释这一点?
I'm calculating the shortest line between a Line and a Point for very short distances (some meters), using Postgis ST_ShortestLine:
SELECT ST_AsText(
ST_ShortestLine(ST_GeomFromText('POINT(2.33123610021 48.87902639841)', 4326),
ST_GeomFromText('LINESTRING ( 2.33122725689 48.87902421718, 2.33123229444 48.87901190847)', 4326))
) As sline;
I get a result which does not seem coherent, the given line not being the shortest one:
LINESTRING(2.33123610021 48.87902639841,2.331227760998549 48.87902298544515)
Here is a drawing of the result, using the Mercator projection (JOSM).
What could explain this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您依靠眼睛来确定绘制线是否是最短的线条,那么您可能会误导这一结论。
ST_SHORTESTLINE
将返回一条与st_distance
完全相同的行,这是两个几何的最小2D笛卡尔距离。这正是正在发生的事情:也许您分享了您期望的结果,我们可以从那里去。
If you're relying on your eyes to determine if the drawn line is the shortest one you might have been mislead to this conclusion.
ST_ShortestLine
will return a line with exact same length ofST_Distance
, which is the minimum 2D cartesian distance of two geometries. And it is exactly what is happening:Perhaps you share the result you're expecting and we can go from there.