GDAL-VECTOR-WRITE(1)

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

πŸ’– GDAL-VECTOR-WRITE(1) πŸ’–

okay bestie, welcome to gdal-vector-write, straight out of the GDAL manual πŸ’… she got added in version 3.11, so she's still kinda new here but she knows exactly what she's doing.


✨ NAME ✨

gdal-vector-write β€” Write a vector dataset (pipeline only)

Added in version 3.11.


🌸 DESCRIPTION 🌸

okay so. the write operation? she is pipeline-only, no cap. you cannot just call her on her own, she lives inside a gdal pipeline, and what she does is write a vector dataset. she is literally the last step of a pipeline. the final boss. the curtain call. πŸ‘‘

and if you're sitting there like "but bestie, i need to write a temp dataset in the middle of my pipeline" β€” no you don't, use gdal vector materialize for that. different girl, different job. 🫢


πŸŽ€ SYNOPSIS πŸŽ€

* write [OPTIONS] <OUTPUT>
--------------------------

Write a vector dataset.

Positional arguments:
  -o, --output <OUTPUT>                                Output vector dataset [required]

Options:
  -f, --of, --format, --output-format <OUTPUT-FORMAT>  Output format ("GDALG" allowed)
  --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
                                                       Mutually exclusive with --upsert
  -l, --output-layer <OUTPUT-LAYER>                    Output layer name
  --skip-errors                                        Skip errors when writing features
  --no-create-empty-layers                             Avoid creating layers to which no features will be written

Advanced Options:
  --output-oo, --output-open-option <KEY>=<VALUE>      Output open options [may be repeated]
  --upsert                                             Upsert features (implies 'append')
                                                       Mutually exclusive with --append

so like, here's the tour 🧚

positional arguments:

  • -o, --output <OUTPUT> β€” the output vector dataset. yes, this one is required, she's not optional, she's the whole point.

options:

  • -f, --of, --format, --output-format <OUTPUT-FORMAT> β€” which output format, and yeah "GDALG" is allowed in there.
  • --co, --creation-option <KEY>=<VALUE> β€” a creation option, may be repeated.
  • --lco, --layer-creation-option <KEY>=<VALUE> β€” a layer creation option, may be repeated.
  • --overwrite β€” is overwriting an existing output dataset allowed or not.
  • --update β€” open an existing dataset in update mode, yes or no.
  • --overwrite-layer β€” can we overwrite the existing output layer.
  • --append β€” can we append to an existing layer. heads up: mutually exclusive with --upsert.
  • -l, --output-layer <OUTPUT-LAYER> β€” the output layer name.
  • --skip-errors β€” skip errors while writing features.
  • --no-create-empty-layers β€” don't create layers that no features will ever be written to. she's efficient like that. πŸ’…

advanced options:

  • --output-oo, --output-open-option <KEY>=<VALUE> β€” output open options, may be repeated.
  • --upsert β€” upsert features (this implies 'append'). mutually exclusive with --append.

⭐ STANDARD OPTIONS ⭐

  • -f, --of, --format, --output-format <OUTPUT-FORMAT> β€” which output vector format you wanna use. and if you need the allowed values, bestie they're right here:
gdal --formats | grep vector | grep rw | sort
  • --co, --creation-option <NAME>=<VALUE> β€” okay so lots of formats have one or more optional dataset creation options that let you control the particulars of the file being created. like, for example, the GeoPackage driver supports creation options that control the version. cute right?

May be repeated.

the dataset creation options available vary by format driver, and some simple formats have literally no creation options at all. you can list the options a format supports with the --formats command line option, buuut the documentation for the format is the definitive source of info on driver creation options. see Vector drivers format specific documentation for the legal creation options for each format.

and note, bestie: dataset creation options are different from layer creation options. don't mix them up. πŸ™ˆ
  • --lco, --layer-creation-option <NAME>=<VALUE> β€” lots of formats also have optional layer creation options to control the particulars of the layer being created. for instance the GeoPackage driver supports layer creation options to control the feature identifier or the geometry column name, setting the identifier or the 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 supported options 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.

same energy: layer creation options are different from dataset creation options. πŸ’€
  • --overwrite β€” allow the program to overwrite an existing target file or dataset. otherwise, by default, gdal errors out if the target file or dataset already exists. so yeah, without this she's gonna throw hands. 😭
  • --update β€” whether to open an existing output dataset in update mode.
  • --overwrite-layer β€” whether overwriting the existing output vector layer is allowed.
  • --append β€” whether appending features to existing layer(s) is allowed. this also creates the output dataset if it doesn't exist yet. very give-it-a-home energy. 🫢
  • --output-layer <NAME> β€” specifies the name of the layer the features get written to. if you don't specify it, the output layer names will just be the same as the input layer names. simple as.
  • --output-open-option, --output-oo <NAME>=<VALUE> β€” Added in version 3.12. ✨

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

May be repeated.

  • --skip-errors β€” Added in version 3.12. ✨

whether failures to write feature(s) should be ignored. and okay, 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. so like, cute for debugging, but don't do this to your database on purpose. 😭

  • --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. like, 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. iconic behaviour honestly. πŸ‘‘


πŸ¦‹ EXAMPLES πŸ¦‹

🌈 Example 1: Write a GeoPackage file 🌈

$ gdal vector pipeline ... [other commands here] ... ! write out.gpkg --overwrite

πŸ’œ AUTHOR πŸ’œ

Even Rouault <even.rouault@spatialys.com>


1998-2026


and that's the whole page, bestie πŸ’– written by Even Rouault, copyright 1998-2026, dated Aug 18, 2026, and it's the GDAL GDAL-VECTOR-WRITE(1) manual. go write something slay. βœ¨πŸŽ€πŸ‘‘

πŸ“¦ where this page comes from