1ogrmerge(1)                 General Commands Manual                ogrmerge(1)
2
3
4

NAME

6       ogrmergeMerge 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 -single:
18                   [-field_strategy FirstLayer|Union|Intersection]
19                   [-src_layer_field_name name]
20                   [-src_layer_field_content layer_name_template]
21

DESCRIPTION

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

EXAMPLES

147       · Creates a VRT with a layer for each input shapefiles
148
149       ogrmerge.py -f VRT -o merged.vrt *.shp
150
151
152       · Same, but creates a GeoPackage file
153
154       ogrmerge.py -f GPKG -o merged.gpkg *.shp
155
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
163

AUTHORS

165       Even Rouault even.rouault@spatialys.com
166
167
168
169GDAL                            Thu Jul 25 2019                    ogrmerge(1)
Impressum