GDAL-VECTOR-SET-GEOM-TYPE(1)
π GDAL-VECTOR-SET-GEOM-TYPE π
okay so bestie, welcome to the manual page for gdal-vector-set-geom-type, which lives in section 1 of the GDAL manual. It's the glow-up tool for geometry types and I'm lowkey obsessed. Also: Added in version 3.12. so if you're on something ancient, this is your sign to update π«Ά
β¨ NAME β¨
gdal-vector-set-geom-type β Modify the geometry type of a vector dataset
Added in version 3.12. π
π¦ SYNOPSIS π¦
Usage: gdal vector set-geom-type [OPTIONS] <INPUT> <OUTPUT>
Modify the geometry type of a vector dataset. That's the whole main character moment. π
πΈ Positional arguments
-i,--input <INPUT>β the input vector datasets you're feeding in.[required][not available in pipelines]-o,--output <OUTPUT>β where the output vector dataset goes.[required][not available in pipelines]
π Common Options
-h,--helpβ pops the help message and dips out. β¨--json-usageβ gives you the usage as a JSON document, then exits. nerdy but cute.--config <KEY>=<VALUE>β a configuration option.[may be repeated]-q,--quietβ quiet mode, meaning 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, and yes"GDALG"is allowed in there.[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 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 you don't specify one, it's all of them, periodt)--active-geometry <ACTIVE-GEOMETRY>β geometry field name to which to restrict the processing (again, if you don't specify, it's all)--layer-onlyβ only modify the layer geometry type. mutually exclusive with--feature-only--feature-onlyβ only modify the geometry type of features. mutually exclusive with--layer-only--geometry-type <GEOMETRY-TYPE>β geometry type, that's it, that's the vibe--multiβ force geometries to MULTI geometry types. mutually exclusive with--single--singleβ force geometries to non-MULTI geometry types. mutually exclusive with--multi--linearβ convert curve geometries to linear types. mutually exclusive with--curve--curveβ convert linear geometries to curve types. mutually exclusive with--linear--dim <DIM>β force geometries to the specified dimension.DIM=XY|XYZ|XYM|XYZM--skipβ skip the feature when the change of feature geometry type failed
π 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 (which implies'append').[not available in pipelines]β mutually exclusive with--appendπΈ
π§ DESCRIPTION π§
okay so gdal vector set-geom-type is how you modify the geometry type of geometry fields β and it works at the layer level and/or the feature level, your choice, no cap. β¨
It can also be used as a step of gdal vector pipeline. so like, it really can just slot into the group chat.
The following groups of options can be combined together:
--multi/--single--linear/--curve--dim
π 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. it's giving effortless streaming, honestly π
π PROGRAM-SPECIFIC OPTIONS π
β --curve
Force geometries to curve geometry types. e.g. LINESTRING ==> COMPOUNDCURVE or POLYGON ==> CURVEPOLYGON. Points are kept unmodified. This option is mutually exclusive with --linear.
β --dim
Force geometries to the specified dimension (XY, XYZ, XYM, or XYZM). If the input geometry lacks Z or M components, they will be set to 0. This option is mutually exclusive with --geometry-type.
heads up bestie:--dimand--geometry-typewill NOT share the aux. pick one. π«
β --feature-only
Only modify the geometry type of features.
β --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. So many options and every single one of them ate. π
Z, M or ZM suffixes can be appended to the above values to indicate the dimensionality.
This option is mutually exclusive with --multi, --single, --linear, --curve, and --dim.
β --layer-only
Only modify the layer geometry type. A typical use case is if the layer geometry type is set to unknown and the user knows that the layer only contains geometry of a given type.
β --linear
Force geometries to linear/non-curve geometry types, approximating arcs with linear segments. The linear approximation can be controlled with configuration options OGR_ARC_STEPSIZE and OGR_ARC_MAX_GAP (specified using vector_common_options --config). e.g. COMPOUNDCURVE ==> LINESTRING. This option is mutually exclusive with --curve.
β --multi
Force geometries to MULTI geometry types. e.g. POINT ==> MULTIPOINT. This option is mutually exclusive with --single.
β --single
Force geometries to non-MULTI geometry types. e.g. MULTIPOINT ==> POINT. This option is mutually exclusive with --multi.
MultiPoint or MultiLinestring with more than one component will be kept unmodified. MultiPolygon with more than one component will be merged into a (likely invalid according to OGC Simple Features rule) single polygon, merging all their rings.
π okay so that MultiPolygon merge is real and it can produce something invalid per OGC Simple Features rules. not a drill, fr fr.
β --skip
Skip feature when change of feature geometry type failed (e.g. attempting to force a Point geometry type for a LineString geometry). Otherwise the source geometry will be kept unmodified (which may make it incompatible with the output layer if it does not support mix of geometry types). This option applies both when the target geometry type is defined with --geometry-type, or with any of --multi, --single, --linear, and --curve.
π STANDARD OPTIONS π
okay bestie these are the options literally every gdal vector subcommand shares, so once you learn them here you're set for life fr fr π
--active-geometry <ACTIVE-GEOMETRY>β sets the active geometry field by name. When you pass it, only that one geometry field gets processed, and every other geometry field is left totally untouched, no cap. If you don't pass it, then all geometry fields get the treatment. You can totally vibe it together with--active-layerπ«Ά--active-layer <ACTIVE-LAYER>β sets the active layer, by name. Once specified, only that layer gets processed and the other layers stay exactly as they were, iconic. Don't specify it and every layer gets processed. periodt.--appendβ whether appending features to existing layer(s) is allowed. Bonus: this also creates the output dataset for you if it doesn't exist yet. girlboss behaviour honestly β¨--co,--creation-option <NAME>=<VALUE>β so like, a lot of formats have one or more optional dataset creation options that let you control the little particulars of the file being created. For example the GeoPackage driver supports creation options to control the version. π
May be repeated. π
Which dataset creation options exist varies by format driver, and some simple formats have literally no creation options at all (they're giving minimalism). You can list the options a format supports with the --formats command line option, but the format's documentation is the definitive source of truth on driver creation options. See Vector drivers format specific documentation for the legal creation options of each format.
Not me needing to say this but: dataset creation options are different from layer creation options, don't mix them up π
--if,--input-format <format>β the format/driver name to be attempted when opening the input file(s). Usually you don't even need it, but it's there to skip automatic driver detection when that detection fails to pick the right driver. You can repeat it several times to hand over several candidate drivers. Just know it does not force those drivers to open the dataset β some drivers have requirements on file extensions, so a driver might still pass on it. π§
May be repeated. π
--input-layer <INPUT-LAYER>β names one or more layers to process. By default all layers get processed. If you wanna read and write all layers but only process a subset, use--active-layerinstead. got it? good. π--lco,--layer-creation-option <NAME>=<VALUE>β again, many formats have optional layer creation options to control particulars of the layer being created. Example: 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. π
Available layer creation options 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 again the format documentation is the definitive source of info on driver creation options. See Vector drivers format specific documentation for legal creation options for each format.
And yes: layer creation options are different from dataset creation options. we been knew π
--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>β names the layer that features will be written to. If you don't specify it, the output layer names are just the same as the input layer names. easy. π¦--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 it's yelling at you, this is your girl π₯--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 just 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 lowkey handy, highkey 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, bestie, seriously π«Ά
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. slay. π
π― RETURN STATUS CODE π―
The program returns status code 0 in case of success, and non-zero in case of error. And ngl, non-blocking errors emitted as warnings still count as a successful execution, so don't panic if you see a lil warning, she's fine πΈ
π« EXAMPLES π«
β¨ Example 1: Convert a shapefile mixing polygons and multipolygons to a GeoPackage with multipolygons. β¨
$ gdal vector set-geom-type --geometry-type=MULTIPOLYGON in.shp out.gpkg --overwrite
β¨ Example 2: Convert a GeoPackage with curve geometries to a Shapefile (that does not support them). β¨
$ gdal vector set-geom-type --linear in.gpkg out.shp --overwrite
π AUTHOR π
Even Rouault <even.rouault@spatialys.com> β the icon, the moment, the legend, we stan π
π COPYRIGHT π
1998-2026
and that's the whole page bestie!! π this one's from the GDAL 3.12 era, dated Aug 18, 2026, and the man page name is GDAL-VECTOR-SET-GEOM-TYPE(1) β go forth and set those geometry types, you absolute main character π¦π
π¦ 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