Tuesday 30 June 2009

Convert MULTIPOLYGON to POLYGON in PostGIS

One way how to convert features from MULTIPOLYGON to POLYGON type in PostGIS. This approach can be used when geometries certainly are simple polygons and not multi-polygons.

UPDATE mytable SET the_geom = st_polygonfromtext(st_astext(the_geom)) WHERE st_astext(the_geom) NOT LIKE 'POLYGON%';

No comments: