snippetbashTip
ogrmerge.py — Merge several vector datasets into a single one. More information: <https://gdal.org/en/stable/progr
Viewed 0 times
vectorcommandcliintoseveralmergedatasetsogrmerge.py
Problem
How to use the
ogrmerge.py command: Merge several vector datasets into a single one. More information: <https://gdal.org/en/stable/programs/ogrmerge.html>.Solution
ogrmerge.py — Merge several vector datasets into a single one. More information: <https://gdal.org/en/stable/programs/ogrmerge.html>.Create a GeoPackage with a layer for each input Shapefile:
ogrmerge.py -f {{GPKG}} -o {{path/to/output.gpkg}} {{path/to/input1.shp path/to/input2.shp ...}}Create a virtual datasource (VRT) with a layer for each input GeoJSON:
ogrmerge.py -f {{VRT}} -o {{path/to/output.vrt}} {{path/to/input1.geojson path/to/input2.geojson ...}}Concatenate two vector datasets and store source name of dataset in attribute 'source_name':
ogrmerge.py -single -f {{GeoJSON}} -o {{path/to/output.geojson}} -src_layer_field_name country {{source_name}} {{path/to/input1.shp path/to/input2.shp ...}}Code Snippets
Create a GeoPackage with a layer for each input Shapefile
ogrmerge.py -f {{GPKG}} -o {{path/to/output.gpkg}} {{path/to/input1.shp path/to/input2.shp ...}}Create a virtual datasource (VRT) with a layer for each input GeoJSON
ogrmerge.py -f {{VRT}} -o {{path/to/output.vrt}} {{path/to/input1.geojson path/to/input2.geojson ...}}Concatenate two vector datasets and store source name of dataset in attribute 'source_name'
ogrmerge.py -single -f {{GeoJSON}} -o {{path/to/output.geojson}} -src_layer_field_name country {{source_name}} {{path/to/input1.shp path/to/input2.shp ...}}Context
tldr-pages: common/ogrmerge.py
Revisions (0)
No revisions yet.