.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "GDAL-RASTER-COLOR-MAP" "1" "May 06, 2025" "" "GDAL" .SH NAME gdal-raster-color-map \- Generate a RGB or RGBA dataset from a single band, using a color map .sp Added in version 3.11. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX Usage: gdal raster color\-map [OPTIONS] Generate a RGB or RGBA dataset from a single band, using a color map Positional arguments: \-i, \-\-input Input raster dataset [required] \-o, \-\-output Output raster dataset [required] Common Options: \-h, \-\-help Display help message and exit \-\-json\-usage Display usage as JSON document and exit \-\-config = Configuration option [may be repeated] \-\-progress Display progress bar Options: \-f, \-\-of, \-\-format, \-\-output\-format Output format (\(dqGDALG\(dq allowed) \-\-co, \-\-creation\-option = Creation option [may be repeated] \-\-overwrite Whether overwriting existing output is allowed \-b, \-\-band Input band (1\-based index) (default: 1) \-\-color\-map Color map filename \-\-add\-alpha Adds an alpha mask band to the destination. \-\-color\-selection How to compute output colors from input values. COLOR\-SELECTION=interpolate|exact|nearest (default: interpolate) Advanced Options: \-\-if, \-\-input\-format Input formats [may be repeated] \-\-oo, \-\-open\-option = Open options [may be repeated] .EE .UNINDENT .UNINDENT .SH DESCRIPTION .sp \fBgdal raster color\-map\fP generates a RGB or RGBA dataset from a single band, using a color map, either attached directly to a raster band, or from an external text file. It is typically used to create hypsometric maps from a DEM. .sp This subcommand is also available as a potential step of \fI\%gdal raster pipeline\fP .SS Standard options .INDENT 0.0 .TP .B \-f, \-\-of, \-\-format, \-\-output\-format Which output raster format to use. Allowed values may be given by \fBgdal \-\-formats | grep raster | grep rw | sort\fP .UNINDENT .INDENT 0.0 .TP .B \-\-co = 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. .sp May be repeated. .sp 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 \fI\%\-\-formats\fP command line option but the documentation for the format is the definitive source of information on driver creation options. See \fI\%Raster drivers\fP format specific documentation for legal creation options for each format. .UNINDENT .INDENT 0.0 .TP .B \-\-overwrite Allow program to overwrite existing target file or dataset. Otherwise, by default, \fBgdal\fP errors out if the target file or dataset already exists. .UNINDENT .INDENT 0.0 .TP .B \-b, \-\-band Index (starting at 1) of the band to process. .UNINDENT .INDENT 0.0 .TP .B \-\-color\-map Color map filename containing the association between various raster values and the corresponding wished color. .sp This option must be specified if the input raster band has no attached color table. .sp The text\-based color configuration file generally contains 4 columns per line: the raster value and the corresponding Red, Green, Blue component (between 0 and 255). The raster value can be any floating point value, or the \fBnv\fP keyword for the nodata value. The raster can also be expressed as a percentage: 0% being the minimum value found in the raster, 100% the maximum value. .sp An extra column can be optionally added for the alpha component. If it is not specified, full opacity (255) is assumed. .sp Various field separators are accepted: comma, tabulation, spaces, \(aq:\(aq. .sp Common colors used by GRASS can also be specified by using their name, instead of the RGB triplet. The supported list is: white, black, red, green, blue, yellow, magenta, cyan, aqua, grey/gray, orange, brown, purple/violet and indigo. .INDENT 7.0 .INDENT 3.5 GMT \fB\&.cpt\fP palette files are also supported (COLOR_MODEL = RGB only). .UNINDENT .UNINDENT .sp Note: the syntax of the color configuration file is derived from the one supported by GRASS r.colors utility. ESRI HDR color table files (.clr) also match that syntax. The alpha component and the support of tab and comma as separators are GDAL specific extensions. .sp For example: .INDENT 7.0 .INDENT 3.5 .sp .EX 3500 white 2500 235:220:175 50% 190 185 135 700 240 250 150 0 50 180 50 nv 0 0 0 0 .EE .UNINDENT .UNINDENT .sp To implement a \(dqround to the floor value\(dq mode, the raster value can be duplicate with a new value being slightly above the threshold. For example to have red in [0,10], green in ]10,20] and blue in ]20,30]: .INDENT 7.0 .INDENT 3.5 .sp .EX 0 red 10 red 10.001 green 20 green 20.001 blue 30 blue .EE .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \-\-addalpha Adds an alpha mask band to the output. .UNINDENT .INDENT 0.0 .TP .B \-\-color\-selection interpolate|exact|nearest How to compute output colors from input values: .INDENT 7.0 .IP \(bu 2 \fBinterpolate\fP (default): apply linear interpolation when a raster value falls between two entries of the color map. .IP \(bu 2 \fBexact\fP: only input raster values matching exacting an entry of the color map will be colorized. If none matching color entry is found, the \(dq0,0,0,0\(dq RGBA quadruplet will be used. .IP \(bu 2 \fBnearest\fP: input raster values will be assigned the entry of the color map that is the closest. .UNINDENT .sp \fBNOTE:\fP .INDENT 7.0 .INDENT 3.5 This option is only taken into account when \fI\%\-\-color\-map\fP is specified. .UNINDENT .UNINDENT .UNINDENT .SH GDALG OUTPUT (ON-THE-FLY / STREAMED DATASET) .sp This program supports serializing the command line as a JSON file using the \fBGDALG\fP output format. The resulting file can then be opened as a raster dataset using the \fI\%GDALG: GDAL Streamed Algorithm\fP driver, and apply the specified pipeline in a on\-the\-fly / streamed way. .SH EXAMPLES .SS Example 1: Generates a RGB dataset from a DTED0 file using an external color map .INDENT 0.0 .INDENT 3.5 .sp .EX $ gdal raster color\-map \-\-color\-map=color\-map.txt n43.dt0 out.tif \-\-overwrite .EE .UNINDENT .UNINDENT .SH AUTHOR Even Rouault .SH COPYRIGHT 1998-2025 .\" Generated by docutils manpage writer. .