gdal
Added in version 3.11.
Main "gdal" entry point.
Synopsis
Usage: gdal <COMMAND> [OPTIONS]
where <COMMAND> is one of:
- convert: Convert a dataset (shortcut for 'gdal raster convert' or 'gdal vector convert').
- driver: Command for driver specific operations.
- info: Return information on a dataset (shortcut for 'gdal raster info' or 'gdal vector info').
- mdim: Multidimensional commands.
- pipeline: Execute a pipeline (shortcut for 'gdal raster pipeline' or 'gdal vector pipeline').
- raster: Raster commands.
- vector: Vector commands.
- vsi: GDAL Virtual System Interface (VSI) commands.
Common Options:
-h, --help Display help message and exit
--version Display GDAL version and exit
--json-usage Display usage as JSON document and exit
--drivers Display driver list as JSON document and exit
--config <KEY>=<VALUE> Configuration option [may be repeated]
'gdal <FILENAME>' can also be used as a shortcut for 'gdal info <FILENAME>'.
And 'gdal read <FILENAME> ! ...' as a shortcut for 'gdal pipeline <FILENAME> ! ...'.
Examples
Example 1: Getting information on the file utm.tif
(with JSON output)
$ gdal info utm.tif
Example 2: Converting file utm.tif
to GeoPackage raster
$ gdal convert utm.tif utm.gpkg
Example 3: Getting information on all available commands and subcommands as a JSON document.
$ gdal --json-usage
Example 4: Getting list of all formats supported by the current GDAL build, as text
$ gdal --formats
Example 5: Getting list of all formats supported by the current GDAL build, as JSON.
$ gdal --formats --json
Bash completion
If Bash is used as an interactive shell, users can benefit from completion,
using the <TAB> key. Bash completion is enabled by first sourcing the
$install_prefix/share/bash-completion/completions/gdal
file, which
should be automatically done on a number of binary distributions of GDAL.
Examples of completion
Example 6: Listing sub-commands of "gdal":
$ gdal <TAB><TAB>
==>
convert info pipeline raster vector
Example 7: Completion of a sub-command from its initial letters:
$ gdal r<TAB>
==>
$ gdal raster
Example 8: Listing sub-commands of "gdal raster":
$ gdal raster<TAB><TAB>
==>
convert edit info pipeline reproject
Example 9: Listing switches of "gdal raster"
$ gdal raster -<TAB><TAB>
==>
--approx-stats -f --help --if --json-usage --min-max --no-fl --no-md --oo --stats
--checksum --format --hist --input --list-mdd --mm --no-gcp --no-nodata --open-option --subdataset
--drivers -h -i --input-format --mdd --no-ct --no-mask --of --output-format --version
Example 10: Listing allowed values for a switch
$ gdal raster info --of=<TAB><TAB>
==>
json text
Example 11: Listing allowed creation options, restricted to those valid for the output format, once the output filename has been specified
$ gdal raster convert in.tif out.tif --co <TAB><TAB>
==>
ALPHA= ENDIANNESS= JXL_EFFORT= PIXELTYPE= SOURCE_PRIMARIES_RED= TIFFTAG_TRANSFERRANGE_BLACK=
BIGTIFF= GEOTIFF_KEYS_FLAVOR= JXL_LOSSLESS= PREDICTOR= SOURCE_WHITEPOINT= TIFFTAG_TRANSFERRANGE_WHITE=
BLOCKXSIZE= GEOTIFF_VERSION= LZMA_PRESET= PROFILE= SPARSE_OK= TILED=
[ ... snip ... ]
Example 12: Listing known configuration options starting with AWS
$ gdal --config AWS_<TAB><TAB>
==>
AWS_ACCESS_KEY_ID= AWS_DEFAULT_REGION= AWS_REQUEST_PAYER= AWS_STS_ENDPOINT=
AWS_CONFIG_FILE= AWS_HTTPS= AWS_ROLE_ARN= AWS_STS_REGION=
AWS_CONTAINER_AUTHORIZATION_TOKEN= AWS_MAX_KEYS= AWS_ROLE_SESSION_NAME= AWS_STS_REGIONAL_ENDPOINTS=
AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE= AWS_NO_SIGN_REQUEST= AWS_S3_ENDPOINT= AWS_TIMESTAMP=
AWS_CONTAINER_CREDENTIALS_FULL_URI= AWS_PROFILE= AWS_SECRET_ACCESS_KEY= AWS_VIRTUAL_HOSTING=
AWS_DEFAULT_PROFILE= AWS_REGION= AWS_SESSION_TOKEN= AWS_WEB_IDENTITY_TOKEN_FILE=
Example 13: Auto-completion of EPSG CRS codes
$ gdal raster reproject --dst-crs EPSG:432<TAB>
==>
4322 -- WGS 72 4324 -- WGS 72BE 4326 -- WGS 84 4327 -- WGS 84 (geographic 3D) 4328 -- WGS 84 (geocentric) 4329 -- WGS 84 (3D)
Example 14: Auto-completion of filenames in a cloud storage (assuming credentials are properly set up)
$ gdal raster info /vsis3/my_bucket/b<TAB><TAB>
==>
/vsis3/my_bucket/byte.tif /vsis3/my_bucket/byte2.tif