1OGRMERGE(1)                          GDAL                          OGRMERGE(1)
2
3
4

NAME

6       ogrmerge -  Merge several vector datasets into a single one.
7

SYNOPSIS

9          ogrmerge.py -o out_dsname src_dsname [src_dsname]*
10                      [-f format] [-single] [-nln layer_name_template]
11                      [-update | -overwrite_ds] [-append | -overwrite_layer]
12                      [-src_geom_type geom_type_name[,geom_type_name]*]
13                      [-dsco NAME=VALUE]* [-lco NAME=VALUE]*
14                      [-s_srs srs_def] [-t_srs srs_def | -a_srs srs_def]
15                      [-progress] [-skipfailures] [--help-general]
16
17       Options specific to the -single option:
18
19          [-field_strategy FirstLayer|Union|Intersection]
20          [-src_layer_field_name name]
21          [-src_layer_field_content layer_name_template]
22

DESCRIPTION

24       New in version 2.2.
25
26
27       ogrmerge.py script takes as input several vector datasets, each of them
28       having one or several vector layers, and copy them in a target dataset.
29
30       There are essential two modes:
31
32       · the default one, where each input vector layer, is copied as a  sepa‐
33         rate layer into the target dataset
34
35       · another  one, activated with the -single switch, where the content of
36         all input vector layers is appended into a single target layer.  This
37         assumes  that  the  schema of those vector layers is more or less the
38         same.
39
40       Internally this generates a vector.vrt file, and if the  output  format
41       is not VRT, final translation is done with ogr2ogr or gdal.VectorTrans‐
42       late(). So, for advanced uses, output to VRT, potential manual  editing
43       of it and ogr2ogr can be done.
44
45       -o <out_dsname
46              Output dataset name. Required.
47
48       <src_dsname>
49              One or several input vector datasets. Required
50
51       -f <format>
52              Select  the output format. Starting with GDAL 2.3, if not speci‐
53              fied, the format is guessed from the extension  (previously  was
54              ESRI Shapefile). Use the short format name
55
56       -single
57              If specified, all input vector layers will be merged into a sin‐
58              gle one.
59
60       -nln <layer_name_template>
61              Name of the output vector layer (in single mode, and the default
62              is  "merged"),  or  template to name the output vector layers in
63              default mode (the default value is  {AUTO_NAME}).  The  template
64              can  be a string with the following variables that will be susb‐
65              stitued with a value computed from the input  layer  being  pro‐
66              cessed:
67
68              · {AUTO_NAME}:  equivalent to {DS_BASENAME}_{LAYER_NAME} if both
69                values are different, or {LAYER_NAME} when they are  identical
70                (case of shapefile). 'different
71
72              · {DS_NAME}: name of the source dataset
73
74              · {DS_BASENAME}: base name of the source dataset
75
76              · {DS_INDEX}: index of the source dataset
77
78              · {LAYER_NAME}: name of the source layer
79
80              · {LAYER_INDEX}: index of the source layer
81
82       -update
83              Open an existing dataset in update mode.
84
85       -overwrite_ds
86              Overwrite  the  existing  dataset if it already exists (for file
87              based datasets)
88
89       -append
90              Open an existing dataset in update mode, and  if  output  layers
91              already exist, append the content of input layers to them.
92
93       -overwrite_layer
94              Open  an  existing  dataset in update mode, and if output layers
95              already exist, replace their content with the one of  the  input
96              layer.
97
98       -src_geom_type <geom_type_name[,geom_type_name]\*]>
99              Only  take  into  account input layers whose geometry type match
100              the type(s) specified. Valid values for geom_type_name are GEOM‐
101              ETRY,  POINT,  LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING,
102              MULTIPOINT,  GEOMETRYCOLLECTION,  CIRCULARSTRING,  CURVEPOLYGON,
103              MULTICURVE,  MULTISURFACE, CURVE, SURFACE, TRIANGLE, POLYHEDRAL‐
104              SURFACE and TIN.
105
106       -dsco <NAME=VALUE>
107              Dataset creation option (format specific)
108
109       -lco <NAME=VALUE>
110              Layer creation option (format specific)
111
112       -a_srs <srs_def>
113              Assign an output SRS
114
115       -t_srs <srs_def>
116              Reproject/transform to this SRS on output
117
118       -s_srs <srs_def>
119              Override source SRS
120
121       -progress
122              Display progress on terminal. Only works if  input  layers  have
123              the "fast feature count" capability.
124
125       -skipfailures
126              Continue after a failure, skipping the failed feature.
127
128       -field_strategy FirstLayer|Union|Intersection
129              Only  used with -single. Determines how the schema of the target
130              layer is built from the schemas of  the  input  layers.  May  be
131              FirstLayer  to  use the fields from the first layer found, Union
132              to use a super-set of all the fields from all source layers,  or
133              Intersection  to use a sub-set of all the common fields from all
134              source layers. Defaults to Union.
135
136       -src_layer_field_name <name>
137              Only used with -single. If specified, the schema of  the  target
138              layer will be extended with a new field 'name', whose content is
139              determined by -src_layer_field_content.
140
141       -src_layer_field_content <layer_name_template>
142              Only used with -single. If specified, the schema of  the  target
143              layer  will be extended with a new field (whose name is given by
144              -src_layer_field_name, or 'source_ds_lyr' otherwise), whose con‐
145              tent   is  determined  by  layer_name_template.  The  syntax  of
146              layer_name_template is the same as for -nln.
147

EXAMPLES

149       Create a VRT with a layer for each input shapefiles
150
151          ogrmerge.py -f VRT -o merged.vrt *.shp
152
153       Same, but creates a GeoPackage file
154
155          ogrmerge.py -f GPKG -o merged.gpkg *.shp
156
157       Concatenate the content of france.shp and  germany.shp  in  merged.shp,
158       and  adds  a 'country' field to each feature whose value is 'france' or
159       'germany' depending where it comes from.
160
161          ogrmerge.py -single -o merged.shp france.shp germany.shp -src_layer_field_name country
162

AUTHOR

164       Even Rouault <even.rouault@spatialys.com>
165
167       1998-2021
168
169
170
171
172                                 Jan 05, 2021                      OGRMERGE(1)
Impressum