GDAL-RASTER-HILLSHADE(1)
β¨ GDAL-RASTER-HILLSHADE(1) β¨
okay bestie, buckle up, we're doing the gdal-raster-hillshade page from the GDAL manual, and it's literally the cutest way to make a shaded relief map of your terrain. no cap. π
πΈ NAME πΈ
gdal-raster-hillshade β Generate a shaded relief map
Added in version 3.11. (yes she's new, she's fresh, she's iconic π)
π¦ SYNOPSIS π¦
Usage: gdal raster hillshade [OPTIONS] <INPUT> <OUTPUT>
Generate a shaded relief map
Positional arguments:
-i, --input <INPUT> Input raster datasets [required] [not available in pipelines]
-o, --output <OUTPUT> Output raster dataset [required] [not available in pipelines]
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 ("GDALG" allowed) [not available in pipelines]
--co, --creation-option <KEY>=<VALUE> Creation option [may be repeated] [not available in pipelines]
--overwrite Whether overwriting existing output dataset is allowed [not available in pipelines]
Mutually exclusive with --append
--append Append as a subdataset to existing output [not available in pipelines]
Mutually exclusive with --overwrite
-b, --band <BAND> Input band (1-based index) (default: 1)
-z, --zfactor <ZFACTOR> Vertical exaggeration used to pre-multiply the elevations
--xscale <XSCALE> Ratio of vertical units to horizontal X axis units
--yscale <YSCALE> Ratio of vertical units to horizontal Y axis units
--azimuth <AZIMUTH> Azimuth of the light, in degrees (default: 315)
--altitude <ALTITUDE> Altitude of the light, in degrees (default: 45)
--gradient-alg <GRADIENT-ALG> Algorithm used to compute terrain gradient. GRADIENT-ALG=Horn|ZevenbergenThorne (default: Horn)
--variant <VARIANT> Variant of the hillshading algorithm. VARIANT=regular|combined|multidirectional|Igor (default: regular)
--no-edges Do not try to interpolate values at dataset edges or close to nodata values
Advanced Options:
--if, --input-format <INPUT-FORMAT> Input formats [may be repeated] [not available in pipelines]
--oo, --open-option <KEY>=<VALUE> Open options [may be repeated] [not available in pipelines]
let's break that whole vibe down, k?
π Positional arguments
-i,--input <INPUT>β the input raster datasets. required, and not available in pipelines. so like, you gotta give it data, bestie. π«Ά-o,--output <OUTPUT>β the output raster dataset. required, also not available in pipelines. no output, no slay.
π Common Options
-h,--helpβ shows the help message and dips. πͺ--json-usageβ prints the usage as a JSON document and dips. for the machine girlies fr fr.--config <KEY>=<VALUE>β a configuration option. you can repeat it as many times as you want. π-q,--quietβ quiet mode: no progress bar, no warning message. not available in pipelines. peace and quiet, we love her. π€«
β Options
-f,--of,--format,--output-format <OUTPUT-FORMAT>β the output format."GDALG"is allowed. not available in pipelines.--co,--creation-option <KEY>=<VALUE>β a creation option, repeatable. not available in pipelines.--overwriteβ whether overwriting an existing output dataset is allowed. not available in pipelines. Mutually exclusive with--appendβ like, pick a lane, you literally cannot do both. π--appendβ append as a subdataset to an existing output. not available in pipelines. Mutually exclusive with--overwrite. same energy, opposite direction.-b,--band <BAND>β the input band, as a 1-based index. default:1.-z,--zfactor <ZFACTOR>β vertical exaggeration used to pre-multiply the elevations. dramatic elevation? we stan.--xscale <XSCALE>β ratio of vertical units to horizontal X axis units.--yscale <YSCALE>β ratio of vertical units to horizontal Y axis units.--azimuth <AZIMUTH>β azimuth of the light, in degrees. default:315.--altitude <ALTITUDE>β altitude of the light, in degrees. default:45.--gradient-alg <GRADIENT-ALG>β the algorithm used to compute terrain gradient.GRADIENT-ALG=Horn|ZevenbergenThorne. default:Horn.--variant <VARIANT>β the variant of the hillshading algorithm.VARIANT=regular|combined|multidirectional|Igor. default:regular.--no-edgesβ do NOT try to interpolate values at dataset edges or close to nodata values.
π§ Advanced Options
--if,--input-format <INPUT-FORMAT>β input formats, repeatable. not available in pipelines.--oo,--open-option <KEY>=<VALUE>β open options, repeatable. not available in pipelines.
π DESCRIPTION π
gdal raster hillshade generates a shaded relief map, from any GDAL-supported elevation raster. any of them. no gatekeeping. β¨
This subcommand is also available as a potential step of gdal raster pipeline. iykyk.
It generates an 8-bit raster with a nice shaded relief effect. (an 8-bit one, specifically β that's the whole aesthetic.) It is very useful for visualizing the terrain. You can optionally specify the azimuth and altitude of the light source, a vertical exaggeration factor, and scaling factors to account for differences between vertical and horizontal units.
The value 0 is used as the output nodata value. A nodata value in the target dataset will be emitted if at least one pixel set to the nodata value is found in the 3x3 window centered around each source pixel. lowkey important, don't skip this part. π
By default, the algorithm will compute values at image edges or if a nodata value is found in the 3x3 window, by interpolating missing values β unless --no-edges is specified, in which case a 1-pixel border around the image will be set with the nodata value. so like, --no-edges means she stops trying at the borders, periodt.
In general, it assumes that x, y and z units are identical. However, if none of --xscale and --yscale are specified, and the CRS is a geographic or projected CRS, it will automatically determine the appropriate ratio from the units of the CRS, as well as the potential value of the units of the raster band (as returned by GDALRasterBand::GetUnitType(), if it is metre, foot international or US survey foot). girlboss behaviour honestly, she does the math for you. π
β οΈ Note that for geographic CRS, the result for source datasets at high latitudes may be incorrect, and prior reprojection to a polar projection might be needed using gdal raster reproject. yes this is a real caveat, do not ignore her.
If x (east-west) and y (north-south) units are identical, but z (elevation) units are different, the --xscale and --yscale can be used to set the ratio of vertical units to horizontal.
For geographic CRS near the equator, where units of latitude and units of longitude are similar, elevation (z) units can be converted to be compatible by using scale=370400 (if elevation is in feet) or scale=111120 (if elevation is in meters).
For locations not near the equator, the --xscale value can be taken as the --yscale value multiplied by the cosine of the mean latitude of the raster. π math is the moment.
π« 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 raster dataset using the GDALG: GDAL Streamed Algorithm driver, and apply the specified pipeline in a on-the-fly / streamed way. so the whole command turns into a JSON file that just... does the thing live. streamed. iconic. π
π₯ PROGRAM-SPECIFIC OPTIONS π₯
--altitude <ALTITUDE>
Altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light. The default value is 45 degree.
This option is mutually exclusive with --variant=Igor. like, they can't both be in the group chat. π«
--azimuth <AZIMUTH>
Azimuth of the light, in degrees. 0 if it comes from the top of the raster, 90 from the east, ... The default value, 315, should rarely be changed as it is the value generally used to generate shaded maps. so like, leave her alone, she knows what she's doing. π
This option is mutually exclusive with --variant=multidirectional. again, mutually exclusive, pick one bestie.
-b, --band <BAND>
Index (starting at 1) of the band to which the hillshade must be computed.
--gradient-alg Horn|ZevenbergenThorne
Algorithm used to compute terrain gradient. The default is Horn.
The literature suggests Zevenbergen & Thorne to be more suited to smooth landscapes, whereas Horn's formula to perform better on rougher terrain. so smooth terrain girlies β Zevenbergen & Thorne, rugged terrain girlies β Horn. both valid, both ate. π
--no-edges
Do not try to interpolate values at dataset edges or close to nodata values
--variant regular|combined|multidirectional|Igor
Variant of the hillshading algorithm:
regular: the hillshade values combines the computed slope with the azimuth and altitude of the illumination according to:
{Hillshade} = 1 + 254.0 * ((\sin(altitude) * cos(slope)) + (cos(altitude) * sin(slope) * cos(azimuth - \frac{\pi}{2} - aspect)))
combined: combined shading, a combination of slope and oblique shading.multidirectional: multidirectional shading, a combination of hillshading illuminated from 225 deg, 270 deg, 315 deg, and 360 deg azimuth. Applies the formula of βhttp://pubs.usgs.gov/of/1992/of92-422/of92-422.pdfIgor: shading which tries to minimize effects on other map features beneath. Igor's hillshading uses formula from Maperitive: βhttp://maperitive.net/docs/Commands/GenerateReliefImageIgor.html
--xscale <scale>
Added in version 3.11. π
Ratio of vertical units to horizontal X axis units. If the horizontal unit of the source DEM is degrees (e.g Lat/Long WGS84 projection), you can use scale=111120 if the vertical units are meters (or scale=370400 if they are in feet).
If none of --xscale and --yscale are specified, and the CRS is a geographic or projected CRS, gdal raster hillshade will automatically determine the appropriate ratio from the units of the CRS, as well as the potential value of the units of the raster band (as returned by GDALRasterBand::GetUnitType(), if it is metre, foot international or US survey foot).
β οΈ Note that for geographic CRS, the result for source datasets at high latitudes may be incorrect, and prior reprojection to a polar projection might be needed.
If --xscale is specified, --yscale must also be specified. they're a package deal, fr fr. π€
--yscale <scale>
Added in version 3.11. πΈ
Ratio of vertical units to horizontal Y axis units. If the horizontal unit of the source DEM is degrees (e.g Lat/Long WGS84 projection), you can use scale=111120 if the vertical units are meters (or scale=370400 if they are in feet)
If none of --xscale and --yscale are specified, and the CRS is a geographic or projected CRS, gdal raster hillshade will automatically determine the appropriate ratio from the units of the CRS, as well as the potential value of the units of the raster band (as returned by GDALRasterBand::GetUnitType(), if it is metre, foot international or US survey foot).
β οΈ Note that for geographic CRS, the result for source datasets at high latitudes may be incorrect, and prior reprojection to a polar projection might be needed.
If --yscale is specified, --xscale must also be specified. yeah, both or neither, periodt. π
-z, --zfactor <ZFACTOR>
Vertical exaggeration used to pre-multiply the elevations.
β¨ STANDARD OPTIONS β¨
okay bestie these are the options that basically every gdal subcommand speaks, so they're giving universal, they're giving "learn once, use everywhere" π
--appendβ appends your input raster as a new subdataset onto an output file that already exists. Heads up tho: this only works with drivers that actually support adding subdatasets, likeGTiff-- GeoTIFF File Format andGPKG-- GeoPackage raster. And cute surprise: if the output dataset doesn't exist yet, this creates it anyway. β¨--co,--creation-option <NAME>=<VALUE>β sets an optional creation option for the format you're writing to, so you can control little specifics about the file being made. For example, the GeoTIFF driver has creation options that control compression and whether the file should be tiled. π
May be repeated.
Which creation options exist depends entirely on the format driver, and some of the super simple formats have literally none. You can list what a format supports with the --formats command line option, but fr fr the definitive source of truth is the format's own documentation. See Raster drivers format specific documentation for the legal creation options per format. π
--if,--input-format <format>β the format/driver name to try when opening your input file(s). Usually you don't need this, but it's the move when automatic driver detection fails to pick the right driver β it can skip that detection. Repeat it as many times as you want to name several candidate drivers. Lowkey important caveat: it doesn't force those drivers to open the dataset. Like, some drivers have requirements on file extensions and they'll still be picky. π
May be repeated.
--oo,--open-option <NAME>=<VALUE>β a dataset open option, and yes it's format specific. πΈ
May be repeated.
-f,--of,--format,--output-format <OUTPUT-FORMAT>β which output raster format to use. Wanna know the allowed values? Run this:
gdal --formats | grep raster | grep rw | sort
--overwriteβ lets the program overwrite a target file or dataset that's already sitting there. Without it, the default behavior is thatgdalerrors out if the target file or dataset already exists. So yeah, if you want the smoke, ask for the smoke. π₯
π RETURN STATUS CODE π
The program returns status code 0 when it ate and left no crumbs (success), and non-zero when something went wrong (error). Quick clarification so nobody panics: non-blocking errors that get emitted as warnings still count as a successful execution. π
π EXAMPLES π
Example 1: Generates a shaded relief map from a DTED0 file, using a vertical exaggeration factor of 30.
$ gdal raster hillshade --zfactor=30 n43.dt0 out.tif --overwrite
Example 2: Combine the output of shaded relief map and hypsometric rendering on a DEM to create a colorized shaded relief map.
$ gdal pipeline read n43.tif ! \
color-map --color-map color_file.txt ! \
blend --operator=hsv-value --overlay \
[ read n43.tif ! hillshade -z 30 ] ! \
write out.tif --overwrite
π AUTHOR π
Even Rouault <even.rouault@spatialys.com>
π COPYRIGHT π
1998-2026
and that's the whole page bestie, you made it to the end π«Ά this beauty is from the GDAL-RASTER-HILLSHADE(1) manual, dated Aug 18, 2026. go make some iconic terrain β¨π
π¦ where this page comes from
- alpine 3.24: gdal-doc 3.13.3-r0 Β· MIT
- arch rolling: gdal 3.13.3-6 Β· MIT
- ubuntu stonking: gdal-bin 3.13.3+dfsg-1ubuntu4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms