[gdal-dev] "Cannot open existing output data source" error writing to GML

Frank Warmerdam warmerdam at pobox.com
Thu Feb 2 18:24:50 EST 2012


The problem is that the GML driver does not support "in place" update or
append support for GML files.  So you can't use the -update -append options
of ogr2ogr with an output GML file.  Instead you will need to collect your
input files into one output file in another format that does support appending.
Shapefiles, and most RDBMS drivers support appending.

Then you can do one ogr2ogr from that aggregate feature collection to
GML in one go.

If you wanted to write a script you could actually write feature from several
sources into one GML file more directly as long as the GML file isn't closed
until all features are written but this is fairly involved.

Best regards,

On Thu, Feb 2, 2012 at 3:04 PM, Donovan Cameron <sault.don at gmail.com> wrote:
> Afternoon List!
> I am trying to batch merge several GML files but get the following error:
> Cannot open existing output data source: output.gml
> I can read the file fine with "ogrinfo output.hml output -so" and everything
> looks normal.
> I am able to perform the operation successfully without error on shapefiles
> from the same source.
> Data is from geobase.ca (geographical place names):
> ftp://ftp2.cits.rncan.gc.ca/pub/geobase/official/cgn/250k_gml_eng/
> Example code:
> for f in *.gml
>  do ogr2ogr -f "GML" merged/output.gml -update -append ${f}
> done
> Is there a write or read limitation in my version of GDAL or the GML that I
> don't know about?
> ogr2ogr --version
> GDAL 1.8.1, released 2011/07/09
> ogr2ogr --formats
>   > "GML" (read/write)
> Thanks for your time and assistance,
> Donovan
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

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 Software Developer

More information about the gdal-dev mailing list