问题遇到的现象和发生背景
在python中想实现,将一条线进行等距分割,并取得将分割后的线段中点坐标
如同Arcgis中的效果(例如图中的一条直线,将此线条分割为12段并取每条线的中点坐标值)
在python中想实现,将一条线进行等距分割,并取得将分割后的线段中点坐标
如同Arcgis中的效果(例如图中的一条直线,将此线条分割为12段并取每条线的中点坐标值)
在 shapely中使用interpolate函数,参考示例代码及链接:
import numpy as np
from shapely.geometry import LineString
from shapely.ops import unary_union
line = LineString(([0, 0], [2, 1], [3, 2], [3.5, 1], [5, 2]))
n = 7
distances = np.linspace(0, line.length, n)
points = [line.interpolate(distance) for distance in distances]
multipoint = unary_union(points) # or new_line = LineString(points)
print(multipoint)
https://stackoverflow.com/questions/62990029/how-to-get-equally-spaced-points-on-a-line-in-shapely