1

How can I convert MultiPolygon to Multiline?

I want to work with the boundary of multipolygon. In R I can just do :

as(my_multi_polygone, 'SpatialLines')

But I don't know how to do it in Python?

0

If multip is the collection of polygons representing the MultiPolygon collection.

multiLines = shapely.geometry.MultiLineString([x.exterior for x in multip])
  • Thanks @saph_top it work but i make for iteration on the geometry of multipoly. multiLines = shapely.geometry.MultiLineString([x.exterior for x in multip.geometry]) – Elite Feb 9 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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