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?

Martin Hügi
  • 3,612
  • 2
  • 22
  • 51
Elite
  • 125
  • 7

1 Answers1

1

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

multiLines = shapely.geometry.MultiLineString([x.exterior for x in multip])
saph_top
  • 284
  • 1
  • 6
  • 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 09 '19 at 20:59