table of contents
- testing 3.12.3+dfsg-1
- unstable 3.12.3+dfsg-1
- experimental 3.13.0+dfsg-1~exp1
| GDAL-VECTOR-LAYER-ALGEBRA(1) | GDAL | GDAL-VECTOR-LAYER-ALGEBRA(1) |
NAME¶
gdal-vector-layer-algebra - Perform algebraic operation between 2 layers
Added in version 3.12.
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]
-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] 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¶
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.
PROGRAM-SPECIFIC OPTIONS¶
- --geometry-type <GEOMETRY-TYPE>
- Change the geometry type to be one of GEOMETRY, POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, CURVE, CIRCULARSTRING, COMPOUNDCURVE, SURFACE, CURVEPOLYGON, MULTICURVE, MULTISURFACE, POLYHEDRALSURFACE or TIN. Z, M or ZM suffixes can be appended to the above values to indicate the dimensionality.
- --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
- •
- intersection
- •
- sym-difference
- •
- identity
- •
- update
- •
- clip
- •
- erase
- --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 to input_ 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 to method_ 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.
STANDARD OPTIONS¶
- --append
- Whether appending features to existing layer(s) is allowed. This also creates the output dataset if it does not exist yet.
- --co, --creation-option <NAME>=<VALUE>
- Many formats have one or more optional dataset creation options that can
be used to control particulars about the file created. For instance, the
GeoPackage driver supports creation options to control the version.
May be repeated.
The dataset creation options available vary by format driver, and some simple formats have no creation options at all. A list of options supported for a format can be listed with the --formats command line option but the documentation for the format is the definitive source of information on driver creation options. See Vector drivers format specific documentation for legal creation options for each format.
Note that dataset creation options are different from layer creation options.
- --if, --input-format <format>
- Format/driver name to be attempted to open the input file(s). It is
generally not necessary to specify it, but it can be used to skip
automatic driver detection, when it fails to select the appropriate
driver. This option can be repeated several times to specify several
candidate drivers. Note that it does not force those drivers to open the
dataset. In particular, some drivers have requirements on file extensions.
May be repeated.
- --lco, --layer-creation-option <NAME>=<VALUE>
- Many formats have one or more optional layer creation options that can be
used to control particulars about the layer 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.
May be repeated.
The layer creation options available vary by format driver, and some simple formats have no layer creation options at all. A list of options supported for a format can be listed with the --formats command line option but the documentation for the format is the definitive source of information on driver creation options. See Vector drivers format specific documentation for legal creation options for each format.
Note that layer creation options are different from dataset creation options.
- --oo, --open-option <NAME>=<VALUE>
- Dataset open option (format specific).
May be repeated.
- -f, --of, --format, --output-format <OUTPUT-FORMAT>
- Which output vector format to use. Allowed values may be given by gdal --formats | grep vector | grep rw | sort
- --output-layer <NAME>
- Specifies the name of the layer to which features will be written. If not specified, output layer names will be the same as input layer names.
- --overwrite
- Allow program to overwrite existing target file or dataset. Otherwise, by default, gdal errors out if the target file or dataset already exists.
- --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 in case of success, and non-zero in case of error (non-blocking errors emitted as warnings are considered as a successful execution).
EXAMPLES¶
Example 1: Performs a union between both input and method layers.¶
$ gdal vector layer-algebra union input.shp method.shp output.shp
AUTHOR¶
Even Rouault <even.rouault@spatialys.com>
COPYRIGHT¶
1998-2026
| May 8, 2026 |