[Gdal-dev] S57 driver: the second import

Frank Warmerdam warmerdam at pobox.com
Thu Aug 19 16:58:21 EDT 2004

Tore Halset wrote:
> On Aug 19, 2004, at 19:39, Tore Halset wrote:
>> On Aug 19, 2004, at 12:25, Tore Halset wrote:
>>> Is it possible to run ogr2ogr multiple times to import different s-57 
>>> data cells into postgis?
>> Using both "-update" and "-lco OVERWRITE=YES" seem to fix the problem. 
>> I also upgraded gdal from version 1.2.0 to 1.2.1.
> Wrong!
> -append -lco OVERWRITE=YES. Does not work if the cell has a layer that 
> does not exist in the database.
> -update -lco OVERWRITE=YES does update features in the database with 
> features in the new cell. An import of a cell with some LNDARE will 
> work, but some of the old LNDARE in the base disapears. Perhaps 
> DSID-DSNM should have been included in the where-part of the query?


Sorry for not responding sooner.

I gather you want to load several S-57 dataset into a set of tables in
PostGIS, is that right?  So, for instance, to append all the features of
a given type from the difference files into one table (ie. all ADMARE
features into one admare table).

This should be achievable ... in general by doing something like:

  ogr2ogr -skipfailures -update PG:<connectinfo> ABC.000 ADMARE

and then adding -append to append to the existing table for subsequent

  ogr2ogr -skipfailures -update -append PG:<connectinfo> DEF.000 ADMAREA

Doing it on all features classes at once may cause problems if different
.000 files have differing sets of features classes, as I think you have
experienced.  There isn't a smooth way of handling this within ogr2ogr
except for doing things one feature classes at a time manually.  You could
of course write a python script to smooth this out and it might be worth it
if you want all features classes and to process alot of files.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the Gdal-dev mailing list