GDAL-VECTOR-FILTER(1)
β¨ NAME β¨
okay so this is the GDAL-VECTOR-FILTER(1) page from the GDAL manual, and it's literally all about gdal-vector-filter β the tool that filters a vector dataset for you π
Added in version 3.11. bestie, it's giving new-but-iconic.
π SYNOPSIS π
Usage: gdal vector filter [OPTIONS] <INPUT> <OUTPUT>
Filter a vector dataset.
Positional arguments (yes both of these are required, no skipping π)
-i,--input <INPUT>β the input vector dataset(s). [required] and [not available in pipelines]-o,--output <OUTPUT>β the output vector dataset. Also [required], also [not available in pipelines]
Common Options π
-h,--helpβ show the help message and dip, exit stage left.--json-usageβ print the usage as a JSON document and exit. nerdy but cute.--config <KEY>=<VALUE>β a configuration option, and yes you can repeat it [may be repeated]-q,--quietβ quiet mode, aka no progress bar and no warning messages [not available in pipelines]
Options π
-l,--layer,--input-layer <INPUT-LAYER>β input layer name(s) [may be repeated] [not available in pipelines]-f,--of,--format,--output-format <OUTPUT-FORMAT>β output format, and"GDALG"is allowed here btw [not available in pipelines]--co,--creation-option <KEY>=<VALUE>β creation option [may be repeated] [not available in pipelines]--lco,--layer-creation-option <KEY>=<VALUE>β layer creation option [may be repeated] [not available in pipelines]--overwriteβ whether overwriting an existing output dataset is allowed [not available in pipelines]--updateβ whether to open an existing dataset in update mode [not available in pipelines]--overwrite-layerβ whether overwriting an existing output layer is allowed [not available in pipelines]--appendβ whether appending to an existing layer is allowed [not available in pipelines] β mutually exclusive with--upsertβ οΈ--output-layer <OUTPUT-LAYER>β output layer name [not available in pipelines]--skip-errorsβ skip errors when writing features [not available in pipelines]--active-layer <ACTIVE-LAYER>β set the active layer (if not specified, all of them get it)--bbox <BBOX>β bounding box, written asxmin,ymin,xmax,ymax--where <WHERE>|@<filename>β attribute query in a restricted form of the queries used in the SQL WHERE statement--update-extentβ update the layer extent so it takes the filter into account
Advanced Options π₯
--if,--input-format <INPUT-FORMAT>β input formats [may be repeated] [not available in pipelines]--oo,--open-option <KEY>=<VALUE>β open options [may be repeated] [not available in pipelines]--output-oo,--output-open-option <KEY>=<VALUE>β output open options [may be repeated] [not available in pipelines]--upsertβ upsert features (implies'append') [not available in pipelines] β mutually exclusive with--appendβ οΈ
π DESCRIPTION π
gdal vector filter filters a vector dataset based on its spatial extent or on a SQL WHERE clause. simple as that, no cap π¦
And it can also be used as a step inside gdal vector pipeline, which is honestly so versatile of it. main character energy fr.
π GDALG OUTPUT (ON-THE-FLY / STREAMED DATASET) π
This program supports serializing the command line into a JSON file using the GDALG output format. obsessed
The resulting file can then be opened as a vector dataset using the GDALG: GDAL Streamed Algorithm driver, and it applies the specified pipeline in an on-the-fly / streamed way. streamed?? on-the-fly?? she said efficiency. β¨
π PROGRAM-SPECIFIC OPTIONS π
--bbox <xmin>,<ymin>,<xmax>,<ymax>β the bounds you want to filter the dataset down to. they're assumed to be in the CRS of the input dataset, ok? The X and Y axis are the "GIS friendly ones", meaning X is longitude or easting, and Y is latitude or northing. And heads up bestie: filtering does not clip geometries to the bounding box β it filters, it does not trim π--update-extentβ updates the layer extent so it accounts for the filter(s). If you don't do this, the layer extent will generally be the one of the source layer before applying the filter(s). Heads up though: using this option requires doing a full scan of the filtered layers, so it's not free β¨--where <WHERE>|@<filename>β attribute query (like SQL WHERE).
πΈ STANDARD OPTIONS πΈ
--active-layer <ACTIVE-LAYER>β sets the active layer. When it's specified, only the layer named by it gets subject to the processing, and the other layers are not modified at all. If you don't specify it, then all layers get subject to the processing. all of them. periodt.--appendβ whether appending features to existing layer(s) is allowed. This also creates the output dataset if it doesn't already exist yet. she's a builder π--co,--creation-option <NAME>=<VALUE>β lots of formats have one or more optional dataset creation options you can use to control particulars about the file being created. for example, the GeoPackage driver supports creation options that 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. You can list the options supported for a format with the --formats command line option, but 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.
β οΈ note that dataset creation options are different from layer creation options. do not mix them up, i'm begging π
--if,--input-format <format>β format/driver name to be attempted when opening the input file(s). It's generally not necessary to specify it, but it can be used to skip automatic driver detection, which is handy when detection fails to select the appropriate driver. You can repeat this option 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. so, yk. iykyk.
[may be repeated]
--input-layer <INPUT-LAYER>β specifies the name of one or more layers to process. By default, all layers get processed. If you want to read and write all layers but only process a subset, use--active-layerinstead π¦--lco,--layer-creation-option <NAME>=<VALUE>β lots of formats have one or more optional layer creation options you can use to control particulars about the layer being created. for instance, the GeoPackage driver supports layer creation options for controlling the feature identifier or the 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 info on driver creation options. See Vector drivers format specific documentation for legal creation options for each format.
β οΈ and note that layer creation options are different from dataset creation options. both of them matter, they are not the same thing!!
--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 can 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 you don't specify it, the output layer names will be the same as the input layer names. slay, consistent.--output-open-option,--output-oo <NAME>=<VALUE>β Added in version 3.12.
Dataset open option for the output dataset (format specific).
[may be repeated]
--overwriteβ allow the program to overwrite an existing target file or dataset. Otherwise, by default,gdalerrors out if the target file or dataset already exists. she said no take-backsies unless you ask π--overwrite-layerβ whether overwriting the existing output vector layer is allowed.--skip-errorsβ Added in version 3.12.
Whether failures to write feature(s) should be ignored. Note that this option sets the size of the transaction unit to one feature at a time, which may cause severe slowdown when inserting into databases. so like, caution, bestie, it's giving slow π
--updateβ whether to open an existing output dataset in update mode.--upsertβ Added in version 3.12.
A variant of --append where the OGRLayer::UpsertFeature() operation is used to insert or update features instead of appending with OGRLayer::CreateFeature().
This is currently implemented only in a few drivers: GPKG -- GeoPackage vector, Elasticsearch: Geographically Encoded Objects for Elasticsearch and MongoDBv3 (drivers that implement upsert expose the GDAL_DCAP_UPSERT capability).
The upsert operation uses the FID of the input feature, when it is set (and the FID column name is not the empty string), as the key to update existing features. It is crucial to make sure that the FID in the source and target layers are consistent. fr fr, do not skip that part.
For the GPKG driver, it's also possible to upsert features whose FID is unset or non-significant (the --unset-fid option of gdal vector edit can be used to ignore the FID from the source feature), when there is a UNIQUE column that is not the integer primary key. iykyk π
β 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, so don't panic over those π«Ά)
π EXAMPLES π
Example 1: Select features from a GeoPackage file that intersect the bounding box from longitude 2, latitude 49, to longitude 3, latitude 50 in WGS 84
$ gdal vector filter --bbox=2,49,3,50 in.gpkg out.gpkg --overwrite
ate that. no notes. π₯
π AUTHOR π
Even Rouault <even.rouault@spatialys.com>
π§ COPYRIGHT π§
1998-2026
okay that's the whole page bestie π this was GDAL-VECTOR-FILTER(1) from the GDAL manual, and the footer said source/version GDAL with the date Aug 18, 2026 β so there you go, go filter something cute. bye bestie, stay streamed β¨πΈπ
π¦ 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