[postgis-users] shp2pgsql options?
Thom DeCarlo
t.r.decarlo at larc.nasa.gov
Tue Mar 21 07:04:05 PST 2006
Ahh... Thanks for that clarification. It just shows how much I have to learn
about these packages.
Thanks again,
Thom
--
Thom DeCarlo
-------------------------------------------------------
Confidence is the feeling you get
before you fully understand the situation.
> -----Original Message-----
> From: Paul Ramsey
> Sent: Monday, March 20, 2006 3:56 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] shp2pgsql options?
>
> Thom,
>
> oids are *not* required by Mapserver. They are used for queries, in
> the case where you have not defined a unique column with "using
> unique" in your DATA statement. But you do have a unique id in your
> table... gid is created by shp2pgsql as a unique primary key.
>
> So load up things in 8.1 w/o oids. Since you are using shp2pgsql as
> your loader, you are getting a unique primary key called 'gid'
> defined for you by the tool. So you can use this as a data statement:
>
> DATA "the_geom from geotable using unique gid"
>
> P.
>
> On Mar 20, 2006, at 12:20 PM, Thom DeCarlo wrote:
>
> > 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
> >
More information about the postgis-users
mailing list