[postgis-users] shp2pgsql options?

Amit Kulkarni amitkulz at yahoo.com
Mon Mar 20 12:59:39 PST 2006


If you see the postgis view, and the .sql file the gid is defined as a
unique serial.

Or you could do a 

1) list shapefiles via ls
2) open each shapefile with a shell/batch script and replace END; with
CREATE INDEX [SHP_name] ON [SHPTBL] ( oid );
END;

HTH

-----------

Hello,
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 becomes:

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? 

Thanks,
Thom

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

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the postgis-users mailing list