[postgis-users] shp2pgsql options?

Thom DeCarlo t.r.decarlo at larc.nasa.gov
Mon Mar 20 12:20:26 PST 2006

I've been trying to load a set of shapefiles into a PostgreSQL 8.1.1 +
PostGIS 1.1.0 database and having a bit of trouble with missing "oids". I've
read that the current PostgreSQL doesn't create tables with OID by default,
but they are required for use with MapServer. Due to that, my load process

shp2pgsql -p -I -s <EPSG> shapefile.shp tablename >tablename_create.sql
vi tablename_create.sql 
   add "WITH OIDS" to the "CREATE TABLE" command
psql -d database -f tablename_create.sql
shp2pgsql -a -s <EPSG> shapefile.shp tablename | psql -d database

That's a bit of a pain when dealing with hundreds of shapefiles. Is there an
option for shp2pgsql (maybe "-O") that would tell it to create the tables
with OIDS? 


Thom DeCarlo
     there was coffee.
     life would go on.
          william gibson, the winter market

More information about the postgis-users mailing list