GDAL-VECTOR-SEGMENTIZE(1)
π GDAL-VECTOR-SEGMENTIZE(1) π
okay bestie, welcome to the GDAL manual β this one's for gdal-vector-segmentize(1), a whole icon in the GDAL lineup. She segments geometries of a vector dataset, she's brand new (added in version 3.12) and honestly? she ate. β¨
πΈ NAME πΈ
gdal-vector-segmentize β segmentize geometries of a vector dataset π¦
Added in version 3.12. (yeah, she's a baby, a very talented baby)
π SYNOPSIS π
Usage: gdal vector segmentize [OPTIONS] <INPUT> <OUTPUT> <MAX-LENGTH>
Segmentize geometries of a vector dataset.
Positional arguments:
-i, --input <INPUT> Input vector datasets [required] [not available in pipelines]
-o, --output <OUTPUT> Output vector dataset [required] [not available in pipelines]
--max-length <MAX-LENGTH> Maximum length of a segment [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:
-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 ("GDALG" allowed) [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 existing output dataset is allowed [not available in pipelines]
--update Whether to open existing dataset in update mode [not available in pipelines]
--overwrite-layer Whether overwriting existing output layer is allowed [not available in pipelines]
--append Whether appending to 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 active layer (if not specified, all)
--active-geometry <ACTIVE-GEOMETRY> Geometry field name to which to restrict the processing (if not specified, all)
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
like, look at her. three required things: <INPUT>, <OUTPUT>, <MAX-LENGTH>. no notes. π
β¨ DESCRIPTION β¨
gdal vector segmentize makes sure that segments of LineStrings or rings of Polygons are not longer than the max length you gave her, by inserting intermediate points. basically she sprinkles extra points onto your lines so nothing is overstretched. it's giving pilates for geometries. π§ββοΈ
she runs the OGRGeometry::segmentize() operation. that's the whole engine. no cap.
and yes, she can also be used as a step of gdal vector pipeline. π«Ά
π¦ GDALG OUTPUT (ON-THE-FLY / STREAMED DATASET) π¦
this program supports serializing the command line as a JSON file using the GDALG output format. the resulting file can then be opened as a vector dataset using the GDALG: GDAL Streamed Algorithm driver, and apply the specified pipeline in a on-the-fly / streamed way. so you save the recipe instead of the cake. iconic behaviour honestly π₯
π PROGRAM-SPECIFIC OPTIONS π
--max-length <MAX-LENGTH>β the value you give here is the maximum distance between two consecutive points of the output geometry before intermediate points get added. and the unit of the distance? georeferenced units of the source layer. so don't come at her with meters if your layer is in degrees, she will simply do what you said π
π STANDARD OPTIONS π
--active-geometry <ACTIVE-GEOMETRY>β sets the active geometry field, by its name. when you specify it, only that geometry field gets processed, and all the other geometry fields stay untouched (they're just vibing). if you don't specify it, all geometry fields get processed. you can combine this with--active-layer, they're besties π€--active-layer <ACTIVE-LAYER>β sets the active layer. when it's specified, only the layer you named gets processed. other layers? not modified, not bothered. if you don't specify it, all layers get processed. generous queen.--appendβ whether appending features to existing layer(s) is allowed. this also creates the output dataset if it doesn't exist yet. so she'll build it AND fill it, a multitasker π--co,--creation-option <NAME>=<VALUE>β many formats have one or more optional dataset creation options that control particulars about the file being 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.
heads up bestie: dataset creation options are different from layer creation options. don't mix them up π
--if,--input-format <format>β format/driver name to be attempted to open the input file(s). generally you don't need to specify it, but it's handy to skip automatic driver detection when that fails to pick the right 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 β and some drivers have requirements on file extensions, so no promises okay π
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-layer. subtle but important, bestie.--lco,--layer-creation-option <NAME>=<VALUE>β many formats have one or more optional layer creation options that 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.
and again: layer creation options are different from dataset creation options. the way I keep saying this π
--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 bygdal --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. she's a copycat and we love that for her π--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β 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 don't pass this and the file's there? she's gonna yell. π€--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. π¨ but real talk: this option sets the size of the transaction unit to one feature at a time, which may cause severe slowdown when inserting into databases. like, tragic levels of 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. β οΈ do not skip this step, bestie.
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.
π 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 a warning is not a flop, it's just a lil note π
π EXAMPLES π
Example 1: Make sure that segments of geometries are no longer than one km
(assuming the CRS is in meters, okay? units matter, she's not a mind reader π)
$ gdal vector segmentize --max-length=1000 in.gpkg out.gpkg --overwrite
π AUTHOR π
Even Rouault <even.rouault@spatialys.com> β icon, legend, the moment π
πΈ COPYRIGHT πΈ
1998-2026
and that's the whole page bestie!! tysm for reading, gdal-vector-segmentize says slay, and this was the GDAL manual, dated Aug 18, 2026 πβ¨π¦ go make some little segments now, fr fr π
π
π¦ 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