I am trying to split a LineString into single segments:
from shaply import LineString,MultiPoint from shapely.ops import split xp = [-2,1,2,2.5,4,1,-1,2,4,5,6] yp = [-2,1,1,0,1,2,2,3,4,4,4] list_of_point = list(zip(xp,yp)) profile = LineString(list_of_point)
At the moment I am using
points_to_split = MultiPoint([Point(x,y) for x,y in profile.coords[1:]]) splitted = split(profile,points_to_split) for i in splitted:print(i)
I've got the expected result but it seems quite overcomplicating a process that should be quite easy to handle internally.
Am I missing something?