GDAL-VECTOR-GEOM-SWAP-XY(1)

πŸ“¦
version 3.11.5 Β· 3 versions
, in fedora 43

🌸 gdal-vector-geom-swap-xy πŸ’…

okay bestie, sit DOWN, because this is the gdal-vector-geom-swap-xy manual page (that's the GDAL one, iykyk) and it's about to fix your whole axis-order situation ✨

πŸ“– NAME

gdal-vector-geom-swap-xy β€” swaps the X and Y coordinates of geometries of a vector dataset πŸ¦‹

Added in version 3.11. (so yes, she's new, she's fresh, she's iconic πŸ‘‘)

✨ SYNOPSIS

Usage: gdal vector geom swap-xy [OPTIONS] <INPUT> <OUTPUT>

Swap X and Y coordinates of geometries of a vector dataset.

Positional arguments:
  -i, --input <INPUT>                                  Input vector datasets [required]
  -o, --output <OUTPUT>                                Output vector dataset [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]
  --progress                                           Display progress bar

Options:
  -l, --layer, --input-layer <INPUT-LAYER>             Input layer name(s) [may be repeated]
  -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 is allowed
  --update                                             Whether to open existing dataset in update mode
  --overwrite-layer                                    Whether overwriting existing layer is allowed
  --append                                             Whether appending to existing layer is allowed
  --output-layer <OUTPUT-LAYER>                        Output layer name
  --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]
  --oo, --open-option <KEY>=<VALUE>                    Open options [may be repeated]

πŸ’– DESCRIPTION

So like, gdal vector geom swap-xy does exactly what it says on the tin, no cap: it swaps the X and Y coordinates of geometries 🌈. The classic use case? Working around axis order issues of coordinate reference systems. You know the vibe β€” your data's got X where Y should be and the whole thing is giving chaos 😭. This fixes it.

She can also serve as a step of gdal vector pipeline, because she's a team player like that 🫢

🌟 Standard options

  • -f, --of, --format, --output-format <OUTPUT-FORMAT> β€” which output vector format are we using, bestie? Allowed values may be given by gdal --formats | grep vector | grep rw | sort πŸ’…
  • --co <NAME>=<VALUE> β€” okay so lots of formats have one or more optional dataset creation options that control the little particulars about the file that gets 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. πŸ“š

Careful! Dataset creation options are different from layer creation options. Do not confuse them, I'm begging πŸ™ˆ
  • -lco <NAME>=<VALUE> β€” layer creation option (format specific) πŸŽ€
  • --overwrite β€” lets the program overwrite an existing target file or dataset. Otherwise, by default, gdal errors out if the target file or dataset already exists. So if you're not passing this, don't be shocked when it yells at you πŸ’€
  • --active-layer <ACTIVE-LAYER> β€” sets the active layer. When it's specified, only the layer specified by its name gets the processing treatment; other layers are left completely unbothered, not modified, untouched, main character only πŸ‘‘. If this option is not specified, all layers will be subject to the processing.
  • --active-geometry <ACTIVE-GEOMETRY> β€” sets the active geometry field by its name. When specified, only that geometry field gets processed β€” the other geometry fields are not modified πŸ¦‹. If this option is not specified, all geometry fields will be subject to the processing. And yes, this one can be combined together with --active-layer. Power couple energy πŸ’ž

πŸš€ Advanced options

  • --oo <NAME>=<VALUE> β€” dataset open option (format specific). 🌸

May be repeated.

  • --if <format> β€” format/driver name to be attempted to open the input file(s). It's generally not necessary to specify it, but it can be used to skip automatic driver detection, when it fails to select the appropriate driver. This option can be repeated several times to specify several candidate drivers. πŸ“Ž
Note: it does not force those drivers to open the dataset. In particular, some drivers have requirements on file extensions. So like... it's a suggestion, not a command, bestie 🀷

May be repeated.


🧚 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. Obsessed, honestly πŸ’–


πŸ“ EXAMPLES

✨ Example 1: Basic usage

$ gdal vector geom swap-xy in.gpkg out.gpkg --overwrite

Look at her go. Ate. Periodt πŸ’…


πŸ’œ AUTHOR

Even Rouault <even.rouault@spatialys.com> β€” thank you for your service, king 🫑

1998-2025


and that's the whole page, bestie πŸ¦‹ this came from the GDAL manual, and the page itself is dated Oct 29, 2025 β€” go swap those axes, you've got this πŸ’–βœ¨

πŸ“¦ where this page comes from