How to split a linestring into 3 linestrings with the sublinestring which is in the original linestring #2322
Answered
by
theroggy
xiaojiuwo1993
asked this question in
Q&A
-
there is a |
Beta Was this translation helpful? Give feedback.
Answered by
theroggy
Aug 22, 2025
Replies: 1 comment 1 reply
-
union should do the trick: import shapely
line = shapely.LineString([(1,1),(3,3)])
line2 = shapely.LineString([(1.5,1.5),(2,2)])
union = shapely.union_all([line, line2])
print(union)
for geom in union.geoms:
print(geom) Output:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
xiaojiuwo1993
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
union should do the trick:
Output: