[gdal-dev] ogr2ogr: Stuck trying to append lots of gml files to postgis tables

Stephen Woodbridge woodbri at swoodbridge.com
Sun Mar 22 12:18:12 PDT 2015


Hi all,

I have a directory of gml files. I can load any of them into postgis 
without a problem. What I'm having a problem with is appending each file 
to the existing tables. I'm using : GDAL 1.10.1, released 2013/08/26

$ ogrinfo raw_itn/6360199_sn6103_2c7157.gz
Had to open data source read-only.
INFO: Open of `raw_itn/6360199_sn6103_2c7157.gz'
       using driver `GML' successful.
1: Road (None)
2: RoadLink (Line String)
3: RoadNode (Point)

$ ogrinfo raw_itn/6360199_sn6101_2c5532.gz
Had to open data source read-only.
INFO: Open of `raw_itn/6360199_sn6101_2c5532.gz'
       using driver `GML' successful.
1: RoadLinkInformation (Point)
2: Road (None)
3: RoadLink (Line String)
4: RoadNodeInformation (None)
5: RoadNode (Point)

Here is want I am trying:

dropdb -U postgres -h localhost data_itn
createdb -U postgres -h localhost data_itn
psql -U postgres -h localhost data_itn -c "create extension postgis"
psql -U postgres -h localhost data_itn -c "create schema itn"
psql -U postgres -h localhost data_itn -c "alter database data_itn set 
search_path to itn, public, pg_catalog"

# this loads fine

ogr2ogr -append -f PostgreSQL PG:"host=localhost user=postgres 
dbname=data_itn" raw_itn/6360199_sn6101_2c5532.gz

# all successive tries to append to the existing tables fails

ogr2ogr -append -f PostgreSQL PG:"host=localhost user=postgres 
dbname=data_itn" raw_itn/6360199_sn6103_2c7157.gz
ERROR 1: Layer road already exists, CreateLayer failed.
Use the layer creation option OVERWRITE=YES to replace it.
ERROR 1: Terminating translation prematurely after failed
translation of layer Road (use -skipfailures to skip errors)

If I don't install extension postgis then there is no problem reported 
and it appears to load all the data by appending the tables with the 
geometry in a colum wkb_geometry::bytea.

How can I load the data into postgis. I have over 700 gml files to load.

Thanks,
   -Steve

---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com



More information about the gdal-dev mailing list