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

Martin Spott Martin.Spott at mgras.net
Wed Mar 8 04:16:02 EST 2006


"Thom DeCarlo" wrote:
> 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.

May I suggest the following:
1.) Create tables with constraints and indices from a hand-made SQL
    script.
2.) Convert the shapefiles into SQL with 'shp2pgsql' for a _temporary_
    table, pipe this into 'psql'. Using 'shp2pgsql' over 'ogr2ogr' has
    the advantage that you can specify a SRID (useful for Mapserver and
    such).
3.) Select only the columns that you actually need from the temporary
    table into the work table. Depending on the source of your
    shapefiles they might specify attributes/DB-columns that you never
    expected.

Cheers,
	Martin.
-- 
 Unix _IS_ user friendly - it's just selective about who its friends are !
--------------------------------------------------------------------------



More information about the Gdal-dev mailing list