GDALTINDEX(1)
π gdaltindex β like, the tileindex girlie of the GDAL fam
okay so bestie, welcome to GDALTINDEX(1) from the GDAL manual β this is the page where we learn how to build a shapefile that acts as a raster tileindex. no cap, it's genuinely iconic.
β¨ NAME β¨
gdaltindex β builds a shapefile as a raster tileindex. that's the whole vibe π
π¦ SYNOPSIS π¦
gdaltindex [-f format] [-tileindex field_name] [-write_absolute_path]
[-skip_different_projection] [-t_srs target_srs]
[-src_srs_name field_name] [-src_srs_format [AUTO|WKT|EPSG|PROJ]
[-lyr_name name] index_file [gdal_file]*
πΈ DESCRIPTION πΈ
so what does this little icon actually do? it creates an OGR-supported dataset that has a record for each input raster file β one record per file, periodt. each record carries an attribute containing the filename, plus a polygon geometry that outlines the raster. and that output? literally perfect for using with MapServer as a raster tileindex. iykyk π₯
π«Ά the options (yes, all of them, i would never skip one)
-f <format>β the OGR format of the output tile index file. starting with GDAL 2.3, if you don't specify it, the format gets guessed from the extension (before that, it wasESRI Shapefile, if you're feeling vintage π).-tileindex <field_name>β the output field name that holds the file path/location of the indexed rasters. the default tile index field name islocation.-write_absolute_pathβ the absolute path to the raster files is stored in the tile index file. by default, the raster filenames get put in the file exactly as they're specified on the command line β no glow-up, no rewriting β¨.-skip_different_projectionβ only files with the same projection as files already inserted in the tileindex get inserted (unless-t_srsis specified). default does not check projection and accepts all inputs β everyone's welcome at the party π.-t_srs <target_srs>: β geometries of input files will be transformed to the desired target coordinate reference system. default creates simple rectangular polygons in the same coordinate reference system as the input rasters. (yes, that colon is in the original, we keep it, character for character π )-src_srs_name <field_name>β the name of the field to store the SRS of each tile. this field name can be used as the value of theTILESRSkeyword in MapServer π-src_srs_format <type>β the format in which the SRS of each tile must be written. types can beAUTO,WKT,EPSG,PROJ.-lyr_name <name>β layer name to create/append to in the output tile index file.index_fileβ the name of the output file to create/append to. the default dataset will be created if it doesn't already exist, otherwise it will append to the existing dataset. lowkey self-healing π§<gdal_file>β the input GDAL raster files, can be multiple files separated by spaces. wildcards may also be used (the original says "my also be used" and honestly, same energy, but you know what we mean π«Ά). stores the file locations in the same style as specified here, unless-write_absolute_pathoption is also used.
π EXAMPLES π
okay this is the fun part, let's go π
- produce a shapefile (
doq_index.shp) with a record for every image that the utility found in thedoqfolder. each record holds information that points to the location of the image and also a bounding rectangle shape showing the bounds of the image:
gdaltindex doq_index.shp doq/*.tif
- perform the same command as before, but now we create a GeoPackage instead of a Shapefile. glow-up achieved π¦
gdaltindex -f GPKG doq_index.gpkg doq/*.tif
- the
-t_srsoption can also be used to transform all input rasters into the same output projection:
gdaltindex -t_srs EPSG:4326 -src_srs_name src_srs tile_index_mixed_srs.shp *.tif
- make a tile index from files listed in a text file:
gdaltindex doq_index.shp --optfile my_list.txt
β SEE ALSO β
raster_common_options for other command-line options β and in particular the --optfile switch that can be used to specify a list of input datasets. go read it, bestie, it's giving essential π
π AUTHOR π
Frank Warmerdam <warmerdam@pobox.com> β the main character who wrote this π
π COPYRIGHT π
1998-2026
and that's the whole page bestie β every flag, every default, every path, nothing skipped, no cap π
mwah π β this has been your girl signing off from the GDAL corner of the group chat. page dated Jan 08, 2026, from the GDAL manual set. slay, go index some rasters β¨π¦
π¦ where this page comes from
- epel 9: gdal3.4 3.4.3-5.el9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms