table of contents
- testing 3.12.3+dfsg-1
- unstable 3.12.3+dfsg-1
- experimental 3.13.0~beta1+dfsg-1~exp1
| GDAL-RASTER-AS-FEATURES(1) | GDAL | GDAL-RASTER-AS-FEATURES(1) |
NAME¶
gdal-raster-as-features - Create features representing the pixels of a raster
Added in version 3.12.
SYNOPSIS¶
Usage: gdal raster as-features [OPTIONS] <INPUT> <OUTPUT> Create features from pixels of a raster dataset Positional arguments:
-i, --input <INPUT> Input raster 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] 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
--output-layer <OUTPUT-LAYER> Output layer name
-b, --band <BAND> Input band(s) (1-based index) [may be repeated]
--geometry-type <GEOMETRY-TYPE> Geometry type. GEOMETRY-TYPE=none|point|polygon (default: none)
--skip-nodata Omit NoData pixels from the result
--include-xy Include fields for cell center coordinates
--include-row-col Include columns for row and column Advanced Options:
--if, --input-format <INPUT-FORMAT> Input formats [may be repeated]
--oo, --open-option <KEY>=<VALUE> Open options [may be repeated]
--output-oo, --output-open-option <KEY>=<VALUE> Output open options [may be repeated]
DESCRIPTION¶
gdal raster as-features creates features representing the pixels in a raster dataset. Features may be created as polygons, points, or with no geometry at all. Unlike gdal raster polygonize, adjacent pixels having the same values are not combined.
This algorithm can be part of a gdal pipeline or gdal raster pipeline.
PROGRAM-SPECIFIC OPTIONS¶
- -b, --band <band>
- Specifies the bands for which pixel values should be added as fields of the created features. By default, values will be added for all bands.
- --geometry-type
- Specifies the geometry type of the created features. Options available are "none" (default), "point", or "polygon".
- --include-row-col
- If set, ROW and COL fields will be added with the cell positions.
- --include-xy
- If set, CENTER_X and CENTER_Y fields will be added with the center coordinates of each pixel.
- --output-layer
- Provides a name for the output vector layer. Defaults to "pixels".
- --skip-nodata
- If set, no features will be emitted for pixels equal to the NoData value.
STANDARD OPTIONS¶
- --append
- Whether appending features to existing layer(s) is allowed. This also creates the output dataset if it does not exist yet.
- --co, --creation-option <NAME>=<VALUE>
- Many formats have one or more optional creation options that can be used
to control particulars about the file created. For instance, the GeoTIFF
driver supports creation options to control compression, and whether the
file should be tiled.
May be repeated.
The 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 Raster drivers format specific documentation for legal creation options for each format.
- --if, --input-format <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.
May be repeated.
- --lco, --layer-creation-option <NAME>=<VALUE>
- Many formats have one or more optional layer creation options that can be
used to control particulars about the layer 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 Vector drivers format specific documentation for legal creation options for each format.
Note that layer creation options are different from dataset creation options.
- --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 output dataset (format specific).
May be repeated.
- --overwrite
- Allow program to overwrite existing target file or dataset. Otherwise, by default, gdal errors out if the target file or dataset already exists.
- --overwrite-layer
- Whether overwriting the existing output vector layer is allowed.
- --update
- Whether to open an existing output dataset in update mode.
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).
EXAMPLES¶
Example 1: Create points at the center of pixels having a value less than 150¶
gdal pipeline read input.tif !
reclassify -m "[-inf, 150)=1; DEFAULT=NO_DATA" !
as-features --geometry-type point --skip-nodata !
write out.shp
Example 2: Create a polygon grid dividing the globe into 1-degree chunks¶
gdal pipeline create --bbox -180,-90,180,90 --size 360,180 !
as-features --geometry-type polygon !
write grid.shp
AUTHOR¶
Dan Baston <dbaston@gmail.com>
COPYRIGHT¶
1998-2026
| April 15, 2026 |