GDAL-RASTER-INDEX(1)

πŸ‘‘ NAME πŸ‘‘

gdal-raster-index β€” bestie, it makes a vector index of your raster datasets πŸ’–

No cap, it was Added in version 3.11. β€” so it's new-ish, and it ate.


πŸŽ€ SYNOPSIS πŸŽ€

Usage: gdal raster index [OPTIONS] <INPUT>... <OUTPUT>

Create a vector index of raster datasets.

Positional arguments 🫢

  • -i, --input <INPUT> β€” the input raster datasets. [may be repeated] [required] β€” yes bestie, required, it needs to know what to index
  • -o, --output <OUTPUT> β€” the output vector dataset. [required] β€” where the index goes, also required, no skips

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]
  • -q, --quiet β€” Quiet mode (no progress bar or warning message) [not available in pipelines]

Options 🌸

  • -f, --of, --format, --output-format <OUTPUT-FORMAT> β€” Output format
  • --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. Mutually exclusive with --update
  • --update β€” Whether to open existing dataset in update mode. Mutually exclusive with --overwrite
  • --overwrite-layer β€” Whether overwriting existing output layer is allowed
  • --append β€” Whether appending to existing layer is allowed
  • --nln, --output-layer <OUTPUT-LAYER> β€” Output layer name
  • --recursive β€” Whether input directories should be explored recursively.
  • --filename-filter <FILENAME-FILTER> β€” Pattern that the filenames in input directories should follow ('*' and '?' wildcard) [may be repeated]
  • --min-pixel-size <MIN-PIXEL-SIZE> β€” Minimum pixel size in term of geospatial extent per pixel (resolution) that a raster should have to be selected.
  • --max-pixel-size <MAX-PIXEL-SIZE> β€” Maximum pixel size in term of geospatial extent per pixel (resolution) that a raster should have to be selected.
  • --location-name <LOCATION-NAME> β€” Name of the field with the raster path (default: location)
  • --absolute-path β€” Whether the path to the input datasets should be stored as an absolute path
  • --output-crs <OUTPUT-CRS> β€” Output CRS
  • --metadata <KEY>=<VALUE> β€” Add dataset metadata item [may be repeated]
  • --skip-errors β€” Skip errors related to input datasets
  • --profile <PROFILE> β€” Profile of output dataset. PROFILE=none|STAC-GeoParquet (default: none)
  • --base-url <BASE-URL> β€” Base URL for STAC-GeoParquet href
  • --id-method <ID-METHOD> β€” How to derive STAC-GeoParquet 'id'. ID-METHOD=filename|md5|metadata-item (default: filename)
  • --id-metadata-item <ID-METADATA-ITEM> β€” Name of metadata item used to set STAC-GeoParquet 'id' (default: id)
  • --source-crs-field-name <SOURCE-CRS-FIELD-NAME> β€” Name of the field to store the CRS of each dataset
  • --source-crs-format <SOURCE-CRS-FORMAT> β€” Format in which the CRS of each dataset must be written. SOURCE-CRS-FORMAT=auto|WKT|EPSG|PROJ (default: auto)

πŸ’… DESCRIPTION πŸ’…

Okay so the way that gdal raster index works is: it creates a vector dataset with a record for each input raster file, an attribute holding the filename, and a polygon geometry outlining the raster. Iconic behavior, honestly. And this output is suitable for use with MapServer as a raster tileindex β€” that's the whole vibe, iykyk. πŸ—ΊοΈ

Also, peep gdal driver gti create β€” that's an extension of this command that creates files to be used as input for the GTI driver. Different tool, related energy. ✨

The following options are available:


🌈 PROGRAM-SPECIFIC OPTIONS 🌈

  • --absolute-path β€” the absolute path to the raster files gets stored in the index file. By default though? The raster filenames go in the file exactly as they are specified on the command line. So no sneaky rewriting. πŸ“
  • --base-url <BASE-URL> β€” Added in version 3.13.

Base URL for STAC-GeoParquet, for the href property of the id property in a STAC-GeoParquet index.

  • --filename-filter <FILENAME-FILTER> β€” the pattern that the filenames contained in input directories should follow. So '*' is a wildcard character that matches any number of any characters including none, and '?' is a wildcard character that matches a single character. Comparisons are done in a case insensitive way, bestie. Several filters may be specified.

For example: --filename-filter "*.tif,*.tiff" πŸŽ€

  • --id-metadata-item <ID-METADATA-ITEM> β€” Added in version 3.13.

Name of metadata item used to set STAC-GeoParquet id property. Defaults to id.

  • --id-method filename|md5|metadata-item β€” Added in version 3.13.

How to derive the STAC-GeoParquet id property:

  • filename (the default): only the filename (without directory, but including extension) is used
  • md5: the MD5Sum of the file is computed, and suffixed with the filename.
  • metadata-item: the value of the metadata item defined by --id-metadata-item from each source dataset is used.
  • --location-name <LOCATION-NAME> β€” the output field name to hold the file path/location to the indexed rasters. The default field name is location. πŸ“‚
  • --max-pixel-size <val> β€” Maximum pixel size in term of geospatial extent per pixel (resolution) that a raster should have to be selected. The pixel size is evaluated after reprojection of its extent to the target CRS defined by --output-crs. πŸ”
  • --metadata <KEY>=<VALUE> β€” Write an arbitrary layer metadata item, for formats that support layer metadata. This option may be repeated. (Repeat away, bestie.)
  • --min-pixel-size <val> β€” Minimum pixel size in term of geospatial extent per pixel (resolution) that a raster should have to be selected. The pixel size is evaluated after reprojection of its extent to the target CRS defined by --output-crs. πŸ”
  • --output-crs <OUTPUT-CRS> β€” Geometries of input files will be transformed to the desired target coordinate reference system. The default creates simple rectangular polygons in the same coordinate reference system as the input rasters. No transformation, just vibes. 🌐
  • --profile none|STAC-GeoParquet β€” Added in version 3.13.

Defines the profile of the output dataset. If you select STAC-GeoParquet, a Parquet file conforming to the STAC-GeoParquet specification is created (provided that the Parquet format is also selected). Such a file can be read by the GTI driver. And heads up: setting STAC-GeoParquet also implicitly sets the target CRS to EPSG:4326. It just does that. πŸ’…

  • --recursive β€” Whether input directories should be explored recursively. Go deep, bestie. πŸ•³οΈ
  • --skip-errors β€” Added in version 3.12.

Skip errors related to input datasets.

  • --source-crs-field-name <SOURCE-CRS-FIELD-NAME> β€” The name of the field to store the CRS of each tile. This field name can be used as the value of the TILESRS keyword in MapServer. πŸ—‚οΈ
  • --source-crs-format auto|WKT|EPSG|PROJ β€” The format in which the CRS of each tile must be written. Types can be auto, WKT, EPSG, PROJ. This option should be used together with --source-crs-field-name. They're a package deal. 🫢

⭐ STANDARD OPTIONS ⭐

  • --append β€” Whether appending features to existing layer(s) is allowed. This also creates the output dataset if it does not exist yet. Two-for-one. ✨
  • --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. πŸ“š

  • --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. Do not confuse them, bestie, they are not the same girlies.
  • -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
  • --nln, --output-layer <LAYER> β€” Provides a name for the output vector layer. 🏷️
  • --overwrite β€” Allow program to overwrite existing target file or dataset. Otherwise, by default, gdal errors out if the target file or dataset already exists. So like, it will not just bulldoze your stuff without permission. πŸ™ˆ
  • --overwrite-layer β€” Whether overwriting the existing output vector layer is allowed.
  • --update β€” Whether the output dataset must be opened in update mode. Implies that it already exists. (It has to exist, okay? Don't come at it with a dataset that doesn't.) πŸ’€

πŸ¦‹ RETURN STATUS CODE πŸ¦‹

The program returns status code 0 in case of success, and non-zero in case of error β€” and yeah, non-blocking errors emitted as warnings count as a successful execution. So 0 can still have been a little messy, but that's fine, that's growth. 🌱

✨ EXAMPLES ✨

ok bestie these are the little recipes that make it all click, like a vibe check for your brain πŸ§ πŸ’–


🌸 Example 1 🌸

so picture this: you want a GeoPackage where every single image that the utility sniffed out in the doq folder gets its own record. and each record is holding info that points to where the image lives, plus a bounding rectangle shape showing the bounds of that image. it's giving catalog energy fr fr πŸ“

gdal raster index doq/*.tif doq_index.gpkg

🌸 Example 2 🌸

okay so the --output-crs option can highkey also be used to transform all your input raster geometries into the same output projection. mixed CRSs could never πŸ’…

gdal raster index --output-crs EPSG:4326 --source-crs-field-name=src_srs *.tif tile_index_mixed_crs.gpkg

🌸 Example 3 🌸

this one creates a STAC-GeoParquet compliant index. iconic behaviour, no notes πŸ‘‘βœ¨

gdal raster index --profile STAC-GeoParquet  *.tif index.parquet

🌈 AUTHOR 🌈

Even Rouault <even.rouault@spatialys.com> β€” the main character who wrote this whole thing 🫢


1998-2026 β€” yeah, that's a long legacy and it ate πŸŽ€


okay that's the whole page bestie, we did it πŸ’…βœ¨ this was GDAL-RASTER-INDEX(1), dated Aug 18, 2026, and the copyright is 1998-2026 πŸ¦‹ love u, go index something gorgeous πŸŒΈπŸ’–

πŸ“¦ where this page comes from