转载于:https://www.cnblogs.com/xuanmanstein/p/11068749.html
the nearest point/vertex point of linestring
最新推荐文章于 2024-07-26 12:28:02 发布
转载于:https://www.cnblogs.com/xuanmanstein/p/11068749.html
snorfalorpagus commented on 18 Oct 2014
The point returned is the nearest point on the line to the original point. The nearest point is not necessarily an existing vertex in the LineString, and in this case it isn't.
If you want to find the nearest vertex you should first convert the LineString to a MultiPoint geometry, then use the
nearest_points
operation (note the minor floating point error):This query requires calculating the distance between the original point and each vertex in the original linestring.
直线上距离最近的点,不等于定义时用的vertix
而要得到最近的vertix,关键的思路是把Linestring“退化“成vertix的MultiPoint,退化回"点对点"距离问题,就OK了。