0

I am trying to do the same thing as this post:

Geojson to shapefile convertion using shapefile library

The user answered his own question, but I do not fully understand his answer. Can anyone please explain how he "converted multi-polygons into polygons"?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
aka49
  • 1

1 Answers1

0

A Multipolygon is a list of Polygons; just iterate over your Multis and store every item individually. Think of this like nested lists in Python: You need two loops to flatten a 2-level list, it’s the same for your Polygons.

Just don’t mix things up: A Polygon consists of an outer ring and inner rings (Linestrings) which themselves are lists of Points. Don’t dive too deep when iterating.

The linked answer is incorrect; might only be working in his certain case, or that person just mixed up the terminology. The major difference between Multipolygons and Polygons (besides their inner structure) is that a Multipolygon can have multiple outer rings.

jbndlr
  • 4,965
  • 2
  • 21
  • 31