PostGIS MultiPolygon to Small Polygons – How to Split

multipartpolygonpostgispostgresqlsinglepart

I have a large GeoJSON file with a single very complex MultiPolygon, and I would like to turn it into an identical file with many small polygons.

How can I do this? I can use ogr2ogr or mapshaper or PostGIS, or any other command-line tool.

This is what my file looks like:

enter image description here

Best Answer

As OP figured out, the ST_Dump function from PostGIS is one way to explode multipart geometries to single ones:

When the input geometry is a collection or multi it will return a record for each of the collection components, ... .

ST_Dump is useful for expanding geometries. ... . For example it can be use to expand MULTIPOLYGONS into POLYGONS.

SELECT sometable.field1, 
       (ST_Dump(sometable.the_geom)).geom AS the_geom
FROM sometable;

The following is a related post with Python alternatives: Converting huge multipolygon to polygons

Related Question