I'm reading a shapefile using Fiona:
with fiona.open('data/boroughs/boroughs_n.shp') as source:
mpolys = [p for p in source]
candidate = polys[0]['geometry']
this gives me a dict containing a list of lists of coordinates, and type 'MultiPolygon' However, I'm not sure how to use the coordinates data to create a Shapely MultiPolygon, since it requires a sequence of exterior ring and hole list tuples: [((a1, ..., aM), [(b1, ..., bN), ...]), ...].
Is there a 'correct' way of doing this, using Fiona and Shapely?
Best Answer
You can use the shape function of Shapely:
and a MultiPolygon is a list of Polygons,so
Example with one of my data:
and
see also Append support for MultiPolygons in shapefiles