GDAL-VECTOR-LAYER-ALGEBRA(1)
π gdal-vector-layer-algebra π
okay bestie, welcome to the gdal-vector-layer-algebra page from the GDAL manual (section 1) π yes she's long, yes she's worth it, and no we are not skipping a single flag. buckle up. β¨
πΈ NAME πΈ
gdal-vector-layer-algebra β perform algebraic operation between 2 layers π
Added in version 3.12. so she's fresh out the box, periodt. π
π¦ SYNOPSIS π¦
Usage: gdal vector layer-algebra [OPTIONS] <OPERATION> <INPUT> <METHOD> <OUTPUT>
Perform algebraic operation between 2 layers.
π Positional arguments
--operation <OPERATION>β Operation to perform.OPERATION=union|intersection|sym-difference|identity|update|clip|erase[required] β like, you have to pick one, she's not optional girl. π₯-i,--input <INPUT>β Input vector dataset [required]--method <METHOD>β Method vector dataset [required]-o,--output <OUTPUT>β Output vector dataset [required]
π Common Options
-h,--helpβ Display help message and exit π--json-usageβ Display usage as JSON document and exit--config <KEY>=<VALUE>β Configuration option [may be repeated] π-q,--quietβ Quiet mode (no progress bar or warning message) [not available in pipelines] β so like, she goes silent but only when she's not in a pipeline, iykyk. π€«
β Options
-f,--of,--format,--output-format <OUTPUT-FORMAT>β Output format--co,--creation-option <KEY>=<VALUE>β Creation option [may be repeated] π--lco,--layer-creation-option <KEY>=<VALUE>β Layer creation option [may be repeated] π--overwriteβ Whether overwriting existing output dataset is allowed--updateβ Whether to open existing dataset in update mode--overwrite-layerβ Whether overwriting existing output layer is allowed--appendβ Whether appending to existing layer is allowed--input-layer <INPUT-LAYER>β Input layer name--method-layer <METHOD-LAYER>β Method layer name--output-layer <OUTPUT-LAYER>β Output layer name--geometry-type <GEOMETRY-TYPE>β Geometry type
π Advanced Options
--oo,--open-option <KEY>=<VALUE>β Open options [may be repeated] π--if,--input-format <INPUT-FORMAT>β Input formats [may be repeated] π--input-prefix <INPUT-PREFIX>β Prefix for fields corresponding to input layer--input-field <INPUT-FIELD>β Input field(s) to add to output layer [may be repeated] β Mutually exclusive with--no-input-field,--all-input-fieldπ«--no-input-fieldβ Do not add any input field to output layer β Mutually exclusive with--input-field,--all-input-fieldπ«--all-input-fieldβ Add all input fields to output layer β Mutually exclusive with--input-field,--no-input-fieldπ«--method-prefix <METHOD-PREFIX>β Prefix for fields corresponding to method layer--method-field <METHOD-FIELD>β Method field(s) to add to output layer [may be repeated] β Mutually exclusive with--no-method-field,--all-method-fieldπ«--no-method-fieldβ Do not add any method field to output layer β Mutually exclusive with--method-field,--all-method-fieldπ«--all-method-fieldβ Add all method fields to output layer β Mutually exclusive with--method-field,--no-method-fieldπ«
β¨ DESCRIPTION β¨
so gdal vector layer-algebra performs various vector layer algebraic operations π« the command takes a vector input source and a method source and generates the output of the operation in the specified output file. that's the whole vibe: two layers walk in, one algebraic result walks out. π«Ά
π PROGRAM-SPECIFIC OPTIONS π
--geometry-type <GEOMETRY-TYPE>β Change the geometry type to be one ofGEOMETRY,POINT,LINESTRING,POLYGON,MULTIPOINT,MULTILINESTRING,MULTIPOLYGON,GEOMETRYCOLLECTION,CURVE,CIRCULARSTRING,COMPOUNDCURVE,SURFACE,CURVEPOLYGON,MULTICURVE,MULTISURFACE,POLYHEDRALSURFACEorTIN. and listen, you can slap aZ,MorZMsuffix onto any of those values to indicate the dimensionality. adding letters like accessories, iconic. π--input-layer <INPUT-LAYER>β Name of the input vector layer. π--operation union|intersection|sym-difference|identity|update|clip|eraseβ Select the operation to perform among:- union β A union is a set of features, which represent areas that are in either of the operand layers. The operation is symmetric, and input and method layers can be interchanged. [image] π
- intersection β An intersection is a set of features, which represent the common areas of two layers. The operation is symmetric, and input and method layers can be interchanged. [image] π€
- sym-difference β A symmetric difference is a set of features, which represent areas that are in operand layers but which do not intersect. The operation is symmetric, and input and method layers can be interchanged. [image] π
- identity β The identity method identifies features in the input layer with features in the method layer possibly splitting features into several features. By default the result layer has attributes from both operand layers. [image] πͺͺ
- update β The update method creates a layer, which add features into the input layer from the method layer possibly cutting features in the input layer. By default the result layer has attributes only from the input layer. [image] π
- clip β The clip method creates a layer, which has features from the input layer clipped to the areas of the features in the method layer. By default the result layer has attributes of the input layer. [image] βοΈ
- erase β The erase method creates a layer, which has features from the input layer whose areas are erased by the features in the method layer. By default the result layer has attributes of the input layer. [image] π§½
--method-layer <METHOD-LAYER>β Name of the method vector layer. π
π§ Advanced options
--all-input-fieldβ Add all input fields to output layer. Mutually exclusive with--input-field,--no-input-field. π«--all-method-fieldβ Add all method fields to output layer. Mutually exclusive with--method-field,--no-method-field. π«--input-field <INPUT-FIELD>β Input field(s) to add to output layer [may be repeated] Mutually exclusive with--no-input-field,--all-input-field. ππ«--input-prefix <INPUT-PREFIX>β Prefix for fields corresponding to input layer. Defaults toinput_if there are both input and method fields, otherwise empty string. πΈ--method-field <METHOD-FIELD>β Input field(s) to add to output layer [may be repeated] Mutually exclusive with--no-method-field,--all-method-field. ππ«--method-prefix <METHOD-PREFIX>β Prefix for fields corresponding to method layer. Defaults tomethod_if there are both input and method fields, otherwise empty string. πΈ--no-input-fieldβ Do not add any input field to output layer. Mutually exclusive with--input-field,--all-input-field. π«--no-method-fieldβ Do not add any method field to output layer. Mutually exclusive with--method-field,--all-method-field. π«
bestie we are not done yet, there's a part 2 coming and she has more to say. don't go anywhere ππ¦
β¨ STANDARD OPTIONS β¨
okay bestie, these are the options that basically every gdal vector subcommand shares, so once you learn them here you're set for life π
--appendβ whether we're allowed to append features onto layer(s) that already exist. also, lowkey iconic: this creates the output dataset if it isn't there yet. β¨--co,--creation-option <NAME>=<VALUE>β tons of formats have one or more optional dataset creation options, and these let you control little particulars about the file being created. like, for example, the GeoPackage driver supports creation options that control the version. π
May be repeated.
The dataset creation options you get vary by format driver, and some of the simple formats have literally no creation options at all (rip π«Ά). you can list the options a format supports with the --formats command line option, but the documentation for the format is the definitive source of info on driver creation options. check the Vector drivers format specific documentation for the legal creation options of each format.
heads up bestie: dataset creation options are different from layer creation options. don't get it twisted π
--if,--input-format <format>β the format/driver name we should try to open the input file(s) with. generally you don't need to specify this, but it's there to skip automatic driver detection when the autodetect fails to pick the right driver. can be repeated several times to give several candidate drivers. note that it does not force those drivers to open the dataset β and in particular, some drivers have requirements on file extensions. π
May be repeated.
--lco,--layer-creation-option <NAME>=<VALUE>β lots of formats have optional layer creation options that control particulars about the layer being created. for instance, the GeoPackage driver supports layer creation options to control the feature identifier or geometry column name, setting the identifier or description, etc. so many vibes β¨
May be repeated.
Which layer creation options exist varies by format driver, and some simple formats have none at all. you can list the options a format supports with the --formats command line option, but again, the documentation for the format is the definitive source of info on driver creation options. See Vector drivers format specific documentation for legal creation options for each format.
and yes, layer creation options are different from dataset creation options. two separate girlies, two separate jobs π
--oo,--open-option <NAME>=<VALUE>β dataset open option (format specific). that's it, that's the whole thing π
May be repeated.
-f,--of,--format,--output-format <OUTPUT-FORMAT>β which output vector format we're using. the allowed values can be given by:
gdal --formats | grep vector | grep rw | sort
run that and let it tell you the tea β
--output-layer <NAME>β specifies the name of the layer the features get written to. if you don't specify it, output layer names will just be the same as the input layer names. main character names carrying over, love that for us π--overwriteβ lets the program overwrite an existing target file or dataset. otherwise, by default,gdalerrors out if the target file or dataset already exists. so if you want it gone, say so fr fr πΈ--overwrite-layerβ whether overwriting the existing output vector layer is allowed. β¨--updateβ whether to open an existing output dataset in update mode. π¦
π« RETURN STATUS CODE π«
the program returns status code 0 when it slays (success), and non-zero when it doesn't (error). and no cap: non-blocking errors that get emitted as warnings are still counted as a successful execution, so don't panic π
π EXAMPLES π
Example 1: Performs a union between both input and method layers.
$ gdal vector layer-algebra union input.shp method.shp output.shp
literally copy, paste, watch it cook π₯
π AUTHOR π
Even Rouault <even.rouault@spatialys.com>
(a legend, honestly π)
π COPYRIGHT π
1998-2026
okay bestie, that's the whole page!! this was GDAL-VECTOR-LAYER-ALGEBRA(1), dated Aug 18, 2026 β screenshot it, bookmark it, tattoo it, whatever, just go do your layer algebra and slay π«Άβ¨π
π¦ where this page comes from
- alpine 3.24: gdal-doc 3.13.3-r0 Β· MIT
- arch rolling: gdal 3.13.3-6 Β· MIT
- ubuntu stonking: gdal-bin 3.13.3+dfsg-1ubuntu4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms