GDAL-VECTOR-GEOM-BUFFER(1)

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

πŸ’– GDAL-VECTOR-GEOM-BUFFER(1) πŸ’–

okay so bestie, welcome to the GDAL manual page for gdal-vector-geom-buffer, and yes that is a whole mouthful but we're gonna get through it together. this is a GDAL thing. it's the manual page for the buffer command. periodt.


✨ NAME ✨

gdal-vector-geom-buffer β€” compute a buffer around geometries of a vector dataset πŸ¦‹

Added in version 3.11. (so it's new new, not vintage, we love a fresh drop πŸ’…)


🌸 SYNOPSIS 🌸

Usage: gdal vector geom buffer [OPTIONS] <INPUT> <OUTPUT> <DISTANCE>

Compute a buffer around geometries of a vector dataset. literally that's the whole job, no cap.

Positional arguments

  • -i, --input <INPUT> β€” the input vector datasets. required, bestie, you cannot skip it πŸ™ˆ
  • -o, --output <OUTPUT> β€” the output vector dataset. also required.
  • --distance <DISTANCE> β€” the distance to which to extend the geometry. yes it's required too, three-for-three πŸŽ€

Common Options

  • -h, --help β€” display help message and exit. your emotional support flag 🫢
  • --json-usage β€” display usage as a JSON document and exit.
  • --config <KEY>=<VALUE> β€” configuration option. may be repeated πŸ”
  • --progress β€” display a progress bar. because watching it move is self-care ✨

Options

  • -l, --layer, --input-layer <INPUT-LAYER> β€” input layer name(s). may be repeated πŸ”
  • -f, --of, --format, --output-format <OUTPUT-FORMAT> β€” output format. "GDALG" is allowed in here πŸ‘€
  • --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).
  • --endcap-style <ENDCAP-STYLE> β€” endcap style. ENDCAP-STYLE=round|flat|square (default: round).
  • --join-style <JOIN-STYLE> β€” join style. JOIN-STYLE=round|mitre|bevel (default: round).
  • --mitre-limit <MITRE-LIMIT> β€” mitre ratio limit (only affects mitered join style). (default: 5).
  • --quadrant-segments <QUADRANT-SEGMENTS> β€” number of line segments used to approximate a quarter circle. (default: 8).
  • --side <SIDE> β€” sets whether the computed buffer should be single-sided or not. SIDE=both|left|right (default: both).

Advanced Options

  • --if, --input-format <INPUT-FORMAT> β€” input formats. may be repeated πŸ”
  • --oo, --open-option <KEY>=<VALUE> β€” open options. may be repeated πŸ”

🌈 DESCRIPTION 🌈

gdal vector geom buffer computes a POLYGON or MULTIPOLYGON that represents all points whose distance from a geometry/geography is less than or equal to a given distance. so like, the "everything within X of this shape" zone. it's giving aura expansion πŸ’«

a negative distance shrinks the geometry rather than expanding it. and omg, a negative distance may shrink a polygon completely, in which case POLYGON EMPTY is returned. for points and lines, negative distances always return empty results. so yeah, negative distance = the geometry said "not today" πŸ’€

go peep https://postgis.net/docs/ST_Buffer.html for graphical illustrations of the effect of the different parameters β€” highly recommend, the visuals ate.

this command can also be used as a step of gdal vector pipeline. chain it up bestie πŸ”—

NOTE: this command requires a GDAL build against the GEOS library. no GEOS, no buffer, sorry queen 😭

Standard options

  • -f, --of, --format, --output-format <OUTPUT-FORMAT> β€” which output vector format to use. you can find allowed values by running gdal --formats | grep vector | grep rw | sort ✨
  • --co <NAME>=<VALUE> β€” many formats have one or more optional dataset creation options that can be used to control particulars about the file 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.

note that dataset creation options are different from layer creation options. do not mix them up, i beg πŸ™

  • -lco <NAME>=<VALUE> β€” layer creation option (format specific).
  • -lco <NAME>=<VALUE> β€” layer creation option (format specific). (yes bestie, it's listed twice in the original, so it's listed twice here, we keep the lore intact πŸŽ€)
  • --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 if it's throwing hands about an existing file, this is why.
  • --active-layer <ACTIVE-LAYER> β€” set the active layer. when it is specified, only the layer specified by its name will be subject to the processing. other layers will be not modified. if this option is not specified, all layers will be subject to the processing.
  • --active-geometry <ACTIVE-GEOMETRY> β€” set the active geometry field from its name. when it is specified, only the specified geometry field will be subject to the processing. other geometry fields will be not modified. if this option is not specified, all geometry fields will be subject to the processing. this option can be combined together with --active-layer. they're a duo πŸ‘―
  • --distance <DISTANCE> β€” radius of the buffer around the input geometry. the unit of the distance is in georeferenced units of the source layer. important!! not meters, not feet, whatever the source layer says.
  • --endcap-style round|flat|square β€” specifies the end cap style of the generated buffer. default is round.
  • --join-style round|mitre|bevel β€” sets the join style for outside (reflex) corners between line segments. default is round.
  • --mitre-limit <MITRE-LIMIT> β€” sets the limit on the mitre ratio used for very sharp corners.

default is 5.

the mitre ratio is the ratio of the distance from the corner to the end of the mitred offset corner. when two line segments meet at a sharp angle, a miter join will extend far beyond the original geometry. (and in the extreme case will be infinitely far.) to prevent unreasonable geometry, the mitre limit allows controlling the maximum length of the join corner. corners with a ratio which exceed the limit will be beveled. so it's basically a leash on the spiky bits πŸ¦”

  • --quadrant-segments <QUADRANT-SEGMENTS> β€” sets the number of line segments used to approximate an angle fillet in round joins.

this determines the maximum error in the approximation to the true buffer curve. the default value of 8 gives less than 2% max error in the buffer distance. for a max error of < 1%, use QS = 12. for a max error of < 0.1%, use QS = 18. the error is always less than the buffer distance (in other words, the computed buffer curve is always inside the true curve). it never overshoots, only vibes inward πŸ’…

  • --side both|left|right β€” sets whether the computed buffer should be single-sided or on both side (default).
    • left (resp. right) means that buffer is on the left-hand (resp. right-hand) side of the line when following it in the order of its vertices.

single-side buffering is only applicable to LINESTRING geometry and does not affect POINT or POLYGON geometries, and the end cap style is forced to square. so if you asked for round endcaps and single-sided, square is what you get, that's just the rules bestie

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 is 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 that it does not force those drivers to open the dataset. in particular, some drivers have requirements on file extensions. so it's a hint, not a command, respect the boundaries 🫢

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. on-the-fly is the moment, honestly ✨


πŸ“ EXAMPLES πŸ“

Example 1: Compute a buffer of one km around input geometries (assuming the CRS is in meters)

$ gdal vector geom buffer --distance=1000 in.gpkg out.gpkg --overwrite

one km of personal space, coming right up πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

Even Rouault <even.rouault@spatialys.com> β€” king behavior, we stan 🫑


1998-2025


and that's the whole page bestie, you made it to the end, iconic πŸŽ€βœ¨ this was the GDAL manual page for gdal-vector-geom-buffer, dated Oct 29, 2025 β€” go forth and buffer responsibly, mwah πŸ’…πŸŒˆ

πŸ“¦ where this page comes from