[postgis-users] shp2pgsql question

Markus Schaber schabi at logix-tt.com
Wed Oct 4 01:32:35 PDT 2006


Hi, Stephen,

Stephen Davies wrote:
> I need to load data from a shape file into a PostGIS database.
> shp2pgsql almost does this for me but the geometry type generated is 
> MULTIPOLYGON(2) instead of POLYGON as required by the table constraint.
> 
> Is there a way to edit the generated SQL to tell PostGIS to convert from 
> one to the other? (I would prefer to not have to use a temporary 
> table).

Yes, you can, given that your geometries really are polygons and not
multipolygons.

Replace every occurence of MULTIPOLYGON((( with POLYGON((, and every
occurence of ))) with )).

I'm currently working at a patch that allows shp2pgsql to output
non-multi geometries.

HTH,
Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org



More information about the postgis-users mailing list