[Gdal-dev] problem with ogr2ogr -f PostgreSQL...

Chapman, Martin MChapman at sanz.com
Wed Mar 8 15:55:04 EST 2006


Ethan,

Cool, that was probably my problem as well.  I will try your command
line.

Martin 

-----Original Message-----
From: gdal-dev-bounces at lists.maptools.org
[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Thom DeCarlo
Sent: Wednesday, March 08, 2006 1:32 PM
To: gdal-dev at lists.maptools.org
Subject: RE: [Gdal-dev] problem with ogr2ogr -f PostgreSQL...

Ethan (and everybody else...),
It looks like you folks have already hashed out all of my problems. ;-)
I think the *real* problem is that I'm trying to learn SQL, PostgreSQL,
PostGIS, MapServer, and Apache all in one swell foop. 

That said... I was trying to load the shapefiles into a PostgreSQL
database using the ogr2ogr command. I was blindly following the examples
given on the PostgreSQL page of the gdal.org site.
(http://www.gdal.org/ogr/drv_pg.html)
The example there says:

% ogr2ogr -f PostgreSQL PG:dbname=warmerda tiger_michigan \
     -lco OVERWRITE=yes CompleteChain
% ogr2ogr -update -append -f PostgreSQL PG:dbname=warmerda tiger_ohio \
     CompleteChain

Unfortunately, as you show in your example, the commands should actually
look like this:

% ogr2ogr -f PostgreSQL PG:dbname=warmerda tiger_michigan \
     -lco OVERWRITE=yes -nln CompleteChain
                        ^^^^
% ogr2ogr -update -append -f PostgreSQL PG:dbname=warmerda tiger_ohio \
     -nln CompleteChain
     ^^^^

When I add the "-nln" the new lay is properly created and appended. This
error is duplicated on the PostGIS OGR Wiki page
http://postgis.refractions.net/support/wiki/index.php?OGR%20Examples

Now if I can just figure out what you mean by that "SRID" thingy....

Thom

--
Thom DeCarlo
-------------------------------------------------------
     That Which Does Not Kill Me
       Can Still Hurt Really Bad.

> -----Original Message-----
> From: Ethan Alpert [mailto:ealpert at digitalglobe.com]
> Sent: Tuesday, March 07, 2006 5:55 PM
> To: Thom DeCarlo; gdal-dev at lists.maptools.org
> Subject: RE: [Gdal-dev] problem with ogr2ogr -f PostgreSQL...
> 
> 
> Are you trying to load the shapefiles? If so post your command line.
> 
> 
> Should be something like:
> 
> Ogr2ogr -f PostgresSQL "PG:dbname=<dbname>" your_shapefile.shp -nln 
> layer
> 
> There are many creation options -lco's you may want to use but it 
> would be helpful to know what command line you used as well as what 
> version of GDAL.
> 
> One important thing is to makesure you have granted your database user

> permissions to modify the postgis geometry_columns table. But you'd 
> get an error if that happened.
> 
> -e
> 
> -----Original Message-----
> From: Thom DeCarlo
> Sent: Tuesday, March 07, 2006 3:22 PM
> To: gdal-dev at lists.maptools.org
> Subject: [Gdal-dev] problem with ogr2ogr -f PostgreSQL...
> 
> I've set up my PostGIS-enabled PostgreSQL database and created a 
> dataset called "spatial". I have several shapefiles that I want to 
> load into a single layer. I found the instructions on the gdal website

> but when I specify a layername at the end of the ogr2ogr command it
quietly fails.
> That
> is, no messages of any kind either at the command line nor in the 
> pgsql logfile. If I don't specify a layername the command works just
fine.
> 
> Are there known problems with this function? I'm using PostGIS 1.1.0 
> and PostgreSQL 8.1.1 on RHEL3.
> 
> Thanks,
> Thom
> 
> --
> Thom DeCarlo
> -------------------------------------------------------
>              Who is General Failure
>          and why is he reading my disk?
> 
> 



_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev




More information about the Gdal-dev mailing list