https://shapely.readthedocs.io/en/latest/manual.html
获得一个点和另一个线之间的最短距离,而且获得最短距离对应的线上的点
from shapely.ops import nearest_points
np = nearest_points(line, p)[0]
print(np) # POINT (5 7)
或者
# Length along line that is closest to the point
print(line.project(p))
# Now combine with interpolated point on line
np = line.interpolate(line.project(p))
print(np) # POINT (5 7)
本文介绍如何使用Shapely库计算点与线之间的最短距离,并找到线上距离点最近的位置。通过`nearest_points`函数和`project`方法,可以获取到具体的距离数值和线上的坐标点。

2787

被折叠的 条评论
为什么被折叠?



