0

I have a Shapely Polygon and a LineString. I want to be able to determine which Polygon points are above the LineString and which are below. Alternatively, it would also be alright if I were to splice a Polygon using a LineString and generate two new Polygons.

Are there any built-in Shapely methods that would allow me to do this?

1

1 Answer 1

1

In case anyone else comes searching for this, you can use this to split the polygon into to sub-polygons and work from there:

merged = linemerge([poly.boundary, line])
borders = unary_union(merged)
polygons = polygonize(borders)

Check out this other post in support of this approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.