GDAL-VECTOR-DISSOLVE(1)

πŸ“¦ version 3.13.3, in alpine 3.24, arch rolling, ubuntu stonking

πŸ’– NAME πŸ’–

gdal-vector-dissolve β€” unions the elements of each feature's geometry. literally just smooshing all the pieces of one feature into one glorious shape. πŸ‘‘

Added in version 3.13. ✨


πŸ“œ SYNOPSIS πŸ“œ

Usage: gdal vector dissolve [OPTIONS] <INPUT> <OUTPUT>

Dissolves multipart features

Positional arguments:
  -i, --input <INPUT>                                  Input vector datasets [required] [not available in pipelines]
  -o, --output <OUTPUT>                                Output vector dataset [required] [not available in pipelines]

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

okay bestie, let's run through the tea on every single one of these πŸ‘‡

🧚 Positional arguments (the mains)

  • -i, --input <INPUT> β€” the input vector datasets. required, and it's not available in pipelines.
  • -o, --output <OUTPUT> β€” the output vector dataset. also required, also not available in pipelines.

πŸŽ€ Common Options

  • -h, --help β€” shows the help message and dips. 🫢
  • --json-usage β€” dumps the usage as a JSON document and exits. for the machine-readers πŸ’…
  • --config <KEY>=<VALUE> β€” configuration option, may be repeated.
  • -q, --quiet β€” quiet mode, so 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> β€” the output format; "GDALG" is 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 an existing output dataset is allowed. not available in pipelines.
  • --update β€” whether to open the existing dataset in update mode. not available in pipelines.
  • --overwrite-layer β€” whether overwriting the 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).
  • --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 (and yes, it implies 'append'). not available in pipelines. mutually exclusive with --append.

✨ DESCRIPTION ✨

gdal vector dissolve runs a union operation on the elements of each feature's geometry. and the glow-up has consequences:

  • Duplicate vertices get eliminated. gone. never happened. πŸ’…
  • Nodes get added wherever the input linework intersects.
  • Polygons that overlap get "dissolved" into a single feature. one blob, one feature, no cap.

For linear geometries, the union step is followed by a line-merging step, where lines are merged at points that form an endpoint of exactly two lines.

⚠️ wanna dissolve the geometries of multiple features together? that's a different move β€” first combine them into single features with gdal vector combine. that's the pre-game, bestie.

dissolve can also be used as a step of gdal vector pipeline. slay. πŸš€


🌸 STANDARD OPTIONS 🌸

  • --append β€” whether appending features to existing layer(s) is allowed. bonus: this also creates the output dataset if it doesn't exist yet. two-for-one, iconic. πŸŽ€
  • --active-layer <ACTIVE-LAYER> β€” sets the active layer. when you name one, only that layer is subject to the processing and every other layer stays unmodified. if you don't specify it, all layers get processed. no skipping. πŸ‘‘
  • --active-geometry <ACTIVE-GEOMETRY> β€” sets the active geometry field by its name. name one and only that geometry field gets processed, all the other geometry fields stay unmodified. don't specify it and all geometry fields are subject to processing. and yes, this one can be combined together with --active-layer. bestie duo. 🫢
  • --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. you can list what a format supports with the --formats command line option, but the documentation for the format is the definitive source of information on driver creation options. see the 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 conflate them, i'm begging.
  • --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 can be used to skip automatic driver detection when that detection fails to select the appropriate driver. repeat it 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 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.

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 the Vector drivers format specific documentation for legal creation options for each format.

🚨 and note that layer creation options are different from dataset creation options. yes, again. i said what i said.
  • --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-open-option, --output-oo <NAME>=<VALUE> β€” Added in version 3.12. πŸ†•

Dataset open option for the output dataset (format specific).

May be repeated.

  • --overwrite β€” allows the program to overwrite an existing target file or dataset. otherwise, by default, gdal errors out if the target file or dataset already exists. no sneaky overwrites, that's the vibe check. πŸ’€
  • --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 heads up: this option sets the size of the transaction unit to one feature at a time, which may cause severe slowdown when inserting into databases. you've been warned, bestie.

  • --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.

For the GPKG driver, it is 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 little moment. 😌


🌈 EXAMPLES 🌈

πŸ’œ Example 1: Dissolve country boundaries into continent boundaries

gdal vector pipeline read countries.shp !
    combine --group-by CONTINENT ! \
    dissolve ! \
    write continents.shp

look at that pipeline go. countries in, continents out. ate and left no crumbs. πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

Dan Baston <dbaston@gmail.com>


1998-2026


okay that's the whole thing, bestie β€” this page is from the GDAL manual, version date Aug 18, 2026, and you're officially a dissolve expert now. go union some geometry. mwah πŸ’‹βœ¨πŸ¦‹

πŸ“¦ where this page comes from