This answer to the question ogr2ogr merge two GeoJSON to one GeoJSON explains how to merge to GeoJSONs.

ogr2ogr -f GeoJSON -append original.geojson append_this_to_original.geojson

However, an example from the ogr2ogr manual page:

Example appending to an existing layer (both and flags need to be used):

ogr2ogr -update -append -f PostgreSQL PG:dbname=warmerda abc.tab

The command seems to work without the -update when merging GeoJSONs. Maybe it is required when working with PostgreSQL (example above), but not when working with GeoJSONs.

What is (if any) the effect of using -update when merging GeoJSONs with ogr2ogr?

1 Answer 1


EDIT: The ogr2ogr option -update has no effect when it is used together with -append. The GDAL documentation has been now updated to clarify that -append enables -updateautomatically.


In my original answer I was right that a long time ago user had to give both options explicitly.

Original answer:

From the ogr2ogr documentation you can see that -update affects a datastore but -append affects a layer

-update Open existing output datasource in update mode rather than trying to create a new one

-append Append to existing layer instead of creating new

GeoJSON can have only one layer so for that driver the datastore and layer means the same but that is not the main point.

I guess, but I do not have references, that -update is older option for ogr2ogr than -append and -overwrite, and when the new options were added the behavior of the -update option in the drivers was not touched. Why I think so is that it is just impossible to use -append if GDAL creates a new datastore. When the old datastore is deleted the target layer gets deleted by the same and there is nothing left to append into.

I do know that with the GeoPackage driver it used to be compulsory to use both -update and -append. Without -update the whole .gpkg data file was re-created as empty, which was a pity if it was unintentional and all the layers from the database disappeared by the same.

I made some tests and I can confirm that with the current GDAL version 3.7.9dev -append without -update does not overwrite existing datastore at least with GeoPackage and GeoJSON drivers. There may still be some other drivers which do not automatically set -update when -append is used so be careful. And with GeoJSON driver it is also not necessary to tell the name of the layer to append with -nln but new data gets appended into the one and only existing GeoJSON layer.

The PostGIS example is a bit odd because GDAL cannot create datastores (databases) into PostgreSQL. The driver must be one of the oldest in GDAL/OGR and the update/append may have some special historical meaning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.