#ifndef DOXYGEN_SKIP /* $Id$ */ #endif /* DOXYGEN_SKIP */ /*! \page gdal_utilities GDAL Utilities The following utility programs are distributed with GDAL. \section gdal_utilities_creating Creating New Files Access an existing file to read it is generally quite simple. Just indicate the name of the file or dataset on the commandline. However, creating a file is more complicated. It may be necessary to indicate the the format to create, various creation options affecting how it will be created and perhaps a coordinate system to be assigned. Many of these options are handled similarly by different GDAL utilities, and are introduced here.

-of format
Select the format to create the new file as. The formats are assigned short names such as GTiff (for GeoTIFF) or HFA (for Erdas Imagine). The list of all format codes can be listed with the --formats switch. Only formats list as "(rw)" (read-write) can be written.

Many utilities default to creating GeoTIFF files if a format is not specified. File extensions are not used to guess output format, nor are extensions generally added by GDAL if not indicated in the filename by the user.

-co 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.

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 "--format " commandline option but the web page for the format is the definitive source of information on driver creation options.

-a_srs SRS
Several utilities, (gdal_translate and gdalwarp) include the ability to specify coordinate systems with commandline options like -a_srs (assign SRS to output), -s_srs (source SRS) and -t_srs (target SRS).

These utilities allow the coordinate system (SRS = spatial reference system) to be assigned in a variety of formats.

\section gdal_utilities_switches General Command Line Switches All GDAL command line utility programs support the following "general" options.

--version
Report the version of GDAL and exit.
--formats
List all raster formats supported by this GDAL build (read-only and read-write) and exit. The format support is indicated as follows: 'ro' is read-only driver; 'rw' is read or write (ie. supports CreateCopy); 'rw+' is read, write and update (ie. supports Create). A 'v' is appended for formats supporting virtual IO (/vsimem, /vsigzip, /vsizip, etc).
--format format
List detailed information about a single format driver. The format should be the short name reported in the --formats list, such as GTiff.
--optfile file
Read the named file and substitute the contents into the commandline options list. Lines beginning with # will be ignored. Multi-word arguments may be kept together with double quotes.
--config key value
Sets the named configuration keyword to the given value, as opposed to setting them as environment variables. Some common configuration keywords are GDAL_CACHEMAX (memory used internally for caching in megabytes) and GDAL_DATA (path of the GDAL "data" directory). Individual drivers may be influenced by other configuration options.
--debug value
Control what debugging messages are emitted. A value of ON will enable all debug messages. A value of OFF will disable all debug messages. Another value will select only debug messages containing that string in the debug prefix code.
--help-general
Gives a brief usage message for the generic GDAL commandline options and exit.
\htmlonly

$Id$

\endhtmlonly */ ******************************************************************************* /*! \page gdalinfo gdalinfo lists information about a raster dataset \section synopsis SYNOPSIS \verbatim gdalinfo [--help-general] [-mm] [-stats] [-nogcp] [-nomd] [-noct] [-checksum] [-mdd domain]* datasetname \endverbatim \section description DESCRIPTION The gdalinfo program lists various information about a GDAL supported raster dataset.
-mm
Force computation of the actual min/max values for each band in the dataset.
-stats
Read and display image statistics. Force computation if no statistics are stored in an image.
-nogcp
Suppress ground control points list printing. It may be useful for datasets with huge amount of GCPs, such as L1B AVHRR or HDF4 MODIS which contain thousands of the ones.
-nomd
Suppress metadata printing. Some datasets may contain a lot of metadata strings.
-noct
Suppress printing of color table.
-checksum
Force computation of the checksum for each band in the dataset.
-mdd domain
Report metadata for the specified domain
The gdalinfo will report all of the following (if known): \section example EXAMPLE \verbatim gdalinfo ~/openev/utm.tif Driver: GTiff/GeoTIFF Size is 512, 512 Coordinate System is: PROJCS["NAD27 / UTM zone 11N", GEOGCS["NAD27", DATUM["North_American_Datum_1927", SPHEROID["Clarke 1866",6378206.4,294.978698213901]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",-117], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["metre",1]] Origin = (440720.000000,3751320.000000) Pixel Size = (60.000000,-60.000000) Corner Coordinates: Upper Left ( 440720.000, 3751320.000) (117d38'28.21"W, 33d54'8.47"N) Lower Left ( 440720.000, 3720600.000) (117d38'20.79"W, 33d37'31.04"N) Upper Right ( 471440.000, 3751320.000) (117d18'32.07"W, 33d54'13.08"N) Lower Right ( 471440.000, 3720600.000) (117d18'28.50"W, 33d37'35.61"N) Center ( 456080.000, 3735960.000) (117d28'27.39"W, 33d45'52.46"N) Band 1 Block=512x16 Type=Byte, ColorInterp=Gray \endverbatim \if man \section author AUTHORS Frank Warmerdam , Silke Reimer \endif */ ******************************************************************************* /*! \page gdal_translate gdal_translate converts raster data between different formats \section tsynopsis SYNOPSIS \verbatim gdal_translate [--help-general] [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/ CInt16/CInt32/CFloat32/CFloat64}] [-strict] [-of format] [-b band] [-expand {gray|rgb|rgba}] [-outsize xsize[%] ysize[%]] [-unscale] [-scale [src_min src_max [dst_min dst_max]]] [-srcwin xoff yoff xsize ysize] [-projwin ulx uly lrx lry] [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-a_nodata value] [-gcp pixel line easting northing [elevation]]* [-mo "META-TAG=VALUE"]* [-q] [-sds] [-co "NAME=VALUE"]* src_dataset dst_dataset \endverbatim \section tdescription DESCRIPTION The gdal_translate utility can be used to convert raster data between different formats, potentially performing some operations like subsettings, resampling, and rescaling pixels in the process.
-ot: type
For the output bands to be of the indicated data type.
-strict:
Do'nt be forgiving of mismatches and lost data when translating to the output format.
-of format:
Select the output format. The default is GeoTIFF (GTiff). Use the short format name.
-b band:
Select an input band band for output. Bands are numbered from 1 Multiple -b switches may be used to select a set of input bands to write to the output file, or to reorder bands.
-expand gray|rgb|rgba:
(From GDAL 1.6.0) To expose a dataset with 1 band with a color table as a dataset with 3 (RGB) or 4 (RGBA) bands. Usefull for output drivers such as JPEG, JPEG2000, MrSID, ECW that don't support color indexed datasets. The 'gray' value (from GDAL 1.7.0) enables to expand a dataset with a color table that only contains gray levels to a gray indexed dataset.
-outsize xsize[%] ysize[%]:
Set the size of the output file. Outsize is in pixels and lines unless '%' is attached in which case it is as a fraction of the input image size.
-scale [src_min src_max [dst_min dst_max]]:
Rescale the input pixels values from the range src_min to src_max to the range dst_min to dst_max. If omitted the output range is 0 to 255. If omitted the input range is automatically computed from the source data.
-unscale:
Apply the scale/offset metadata for the bands to convert scaled values to unscaled values. It is also often necessary to reset the output datatype with the -ot switch.
-srcwin xoff yoff xsize ysize:
Selects a subwindow from the source image for copying based on pixel/line location.
-projwin ulx uly lrx lry:
Selects a subwindow from the source image for copying (like -srcwin) but with the corners given in georeferenced coordinates.
-a_srs srs_def:
Override the projection for the output file. The srs_def may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file containing the WKT.
-a_ullr ulx uly lrx lry:
Assign/override the georeferenced bounds of the output file. This assigns georeferenced bounds to the output file, ignoring what would have been derived from the source file.
-a_nodata value:
Assign a specified nodata value to output bands.
-mo "META-TAG=VALUE":
Passes a metadata key and value to set on the output dataset if possible.
-co "NAME=VALUE":
Passes a creation option to the output format driver. Multiple -co options may be listed. See format specific documentation for legal creation options for each format.
-gcp pixel line easting northing elevation:
Add the indicated ground control point to the output dataset. This option may be provided multiple times to provide a set of GCPs.
-q:
Suppress progress monitor and other non-error output.
-sds:
Copy all subdatasets of this file to individual output files. Use with formats like HDF or OGDI that have subdatasets.
src_dataset:
The source dataset name. It can be either file name, URL of data source or subdataset name for multi-dataset files.
dst_dataset:
The destination file name.
\section texample EXAMPLE \verbatim gdal_translate -of GTiff -co "TILED=YES" utm.tif utm_tiled.tif \endverbatim \if man \section tauthor AUTHORS Frank Warmerdam , Silke Reimer \endif */ ******************************************************************************* /*! \page gdaladdo gdaladdo builds or rebuilds overview images \section asynopsis SYNOPSIS \verbatim gdaladdo [-r {nearest,average,gauss,cubic,average_mp,average_magphase,mode}] [-ro] [-clean] [--help-general] filename levels \endverbatim \section adescription DESCRIPTION The gdaladdo utility can be used to build or rebuild overview images for most supported file formats with one over several downsampling algorithms.
-r {nearest (default),average,gauss,cubic,average_mp,average_magphase,mode}:
Select a resampling algorithm.
-ro
:
(available from GDAL 1.6.0) open the dataset in read-only mode, in order to generate external overview (for GeoTIFF especially).
-clean
:
(available from GDAL 1.7.0) remove all overviews.
filename:
The file to build overviews for (or whose overviews must be removed).
levels:
A list of integral overview levels to build. Ignored with -clean option.
Mode (available from GDAL 1.6.0) selects the value which appears most often of all the sampled points. average_mp is unsuitable for use. Average_magphase averages complex data in mag/phase space. Nearest and average are applicable to normal image data. Nearest applies a nearest neighbour (simple sampling) resampler, while average computes the average of all non-NODATA contributing pixels. Cubic resampling (available from GDAL 1.7.0) applies a 4x4 approximate cubic convolution kernel. Gauss resampling (available from GDAL 1.6.0) applies a Gaussian kernel before computing the overview, which can lead to better results than simple averaging in e.g case of sharp edges with high contrast or noisy patterns. The advised level values should be 2, 4, 8, ... so that a 3x3 resampling Gaussian kernel is selected. gdaladdo will honour properly NODATA_VALUES tuples (special dataset metadata) so that only a given RGB triplet (in case of a RGB image) will be considered as the nodata value and not each value of the triplet independantly per band. Selecting a level value like 2 causes an overview level that is 1/2 the resolution (in each dimension) of the base layer to be computed. If the file has existing overview levels at a level selected, those levels will be recomputed and rewritten in place. Some format drivers do not support overviews at all. Many format drivers store overviews in a secondary file with the extension .ovr that is actually in TIFF format. By default, the GeoTIFF driver stores overviews internally to the file operated on (if it is writable), unless the -ro flag is specified. External overviews created in TIFF format may be compressed using the COMPRESS_OVERVIEW configuration option. All compression methods, supported by the GeoTIFF driver, available here. (eg --config COMPRESS_OVERVIEW DEFLATE). The photometric interpretation can be set with --config PHOTOMETRIC_OVERVIEW {RGB,YCBCR,...}, and the interleaving with --config INTERLEAVE_OVERVIEW {PIXEL|BAND}. To produce the smallest possible JPEG-In-TIFF overviews, you should use : \verbatim --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config INTERLEAVE_OVERVIEW PIXEL \endverbatim Starting with GDAL 1.7.0, external overviews can be created in the BigTIFF format by using the BIGTIFF_OVERVIEW configuration option : --config BIGTIFF_OVERVIEW {IF_NEEDED|IF_SAFER|YES|NO}. The default value is IF_NEEDED. The behaviour of this option is exactly the same as the BIGTIFF creation option documented in the GeoTIFF driver documentation.
  • YES forces BigTIFF.
  • NO forces classic TIFF.
  • IF_NEEDED will only create a BigTIFF if it is clearly needed (uncompressed, and overviews larger than 4GB).
  • IF_SAFER will create BigTIFF if the resulting file *might* exceed 4GB.

Most drivers also support an alternate overview format using Erdas Imagine format. To trigger this use the USE_RRD=YES configuration option. This will place the overviews in an associated .aux file suitable for direct use with Imagine or ArcGIS as well as GDAL applications. (eg --config USE_RRD YES) \section aexample EXAMPLE \htmlonly Example: \endhtmlonly Create overviews, embedded in the supplied TIFF file: \verbatim gdaladdo -r average abc.tif 2 4 8 16 \endverbatim Create an external compressed GeoTIFF overview file from the ERDAS .IMG file: \verbatim gdaladdo -ro --config COMPRESS_OVERVIEW DEFLATE erdas.img 2 4 8 16 \endverbatim Create an external JPEG-compressed GeoTIFF overview file from a 3-band RGB dataset (if the dataset is a writable GeoTIFF, you also need to add the -ro option to force the generation of external overview): \verbatim gdaladdo --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config INTERLEAVE_OVERVIEW PIXEL rgb_dataset.ext 2 4 8 16 \endverbatim Create an Erdas Imagine format overviews for the indicated JPEG file: \verbatim gdaladdo --config USE_RRD YES airphoto.jpg 3 9 27 81 \endverbatim \if man \section aauthor AUTHORS Frank Warmerdam , Silke Reimer \endif */ ******************************************************************************* /*! \page gdaltindex gdaltindex builds a shapefile as a raster tileindex \section isynopsis SYNOPSIS \verbatim gdaltindex [-tileindex field_name] [-write_absolute_path] [-skip_different_projection] index_file [gdal_file]* \endverbatim \section idescription DESCRIPTION This program builds a shapefile with a record for each input raster file, an attribute containing the filename, and a polygon geometry outlining the raster. This output is suitable for use with MapServer as a raster tileindex.
  • The shapefile (index_file) will be created if it doesn't already exist, otherwise it will append to the existing file.
  • The default tile index field is 'location'.
  • Raster filenames will be put in the file exactly as they are specified on the commandline unless the option -write_absolute_path is used.
  • If -skip_different_projection is specified, only files with same projection ref as files already inserted in the tileindex will be inserted.
  • Simple rectangular polygons are generated in the same coordinate system as the rasters.
\section iexample EXAMPLE \htmlonly Example: \endhtmlonly \verbatim gdaltindex doq_index.shp doq/*.tif \endverbatim \if man \section wauthor AUTHOR Frank Warmerdam \endif */ ******************************************************************************* /*! \page gdalbuildvrt gdalbuildvrt Builds a VRT from a list of datasets. (compiled by default since GDAL 1.6.1) \section gdalbuildvrt_synopsis SYNOPSIS \verbatim gdalbuildvrt [-tileindex field_name] [-resolution {highest|lowest|average|user}] [-tr xres yres] [-separate] [-allow_projection_difference] [-q] [-te xmin ymin xmax ymax] [-addalpha] [-hidenodata] [-srcnodata "value [value...]"] [-vrtnodata "value [value...]"] [-input_file_list my_liste.txt] output.vrt [gdalfile]* \endverbatim \section gdalbuildvrt_description DESCRIPTION This program builds a VRT (Virtual Dataset) that is a mosaic of the list of input gdal datasets. The list of input gdal datasets can be specified at the end of the command line, or put in a text file (one filename per line) for very long lists, or it can be a MapServer tileindex (see \ref gdaltindex utility). In the later case, all entries in the tile index will be added to the VRT. With -separate, each files goes into a separate stacked band in the VRT band. Otherwise, the files are considered as tiles of a larger mosaic and the VRT file has as many bands as one of the input files. If one GDAL dataset is made of several subdatasets and has 0 raster bands, all the subdatasets will be added to the VRT rather than the dataset itself. gdalbuildvrt does some amount of checks to assure that all files that will be put in the resulting VRT have similar characteristics : number of bands, projection, color interpretation... If not, files that do not match the common characteristics will be skipped. (This is only true in the default mode, and not when using the -separate option) If there is some amount of spatial overlapping between files, the order may depend on the order they are inserted in the VRT file, but this behaviour should not be relied on. This utility is somehow equivalent to the gdal_vrtmerge.py utility and is build by default in GDAL 1.6.1.
-tileindex:
Use the specified value as the tile index field, instead of the default value with is 'location'.
-resolution {highest|lowest|average|user}:
In case the resolution of all input files is not the same, the -resolution flag enables the user to control the way the output resolution is computed. 'average' is the default. 'highest' will pick the smallest values of pixel dimensions within the set of source rasters. 'lowest' will pick the largest values of pixel dimensions within the set of source rasters. 'average' will compute an average of pixel dimensions within the set of source rasters. 'user' is new in GDAL 1.7.0 and must be used in combination with the -tr option to specify the target resolution.
-tr xres yres :
(starting with GDAL 1.7.0) set target resolution. The values must be expressed in georeferenced units. Both must be positive values. Specifying those values is of curse incompatible with highest|lowest|average values for -resolution option.
-te xmin ymin xmax ymax :
(starting with GDAL 1.7.0) set georeferenced extents of VRT file. The values must be expressed in georeferenced units. If not specified, the extent of the VRT is the minimum bounding box of the set of source rasters.
-addalpha:
(starting with GDAL 1.7.0) Adds an alpha mask band to the VRT when the source raster have none. Mainly useful for RGB sources (or grey-level sources). The alpha band is filled on-the-fly with the value 0 in areas without any source raster, and with value 255 in areas with source raster. The effect is that a RGBA viewer will render the areas without source rasters as transparent and areas with source rasters as opaque. This option is not compatible with -separate.
-hidenodata:
(starting with GDAL 1.7.0) Even if any band contains nodata value, giving this option makes the VRT band not report the NoData. Useful when you want to control the background color of the dataset. By using along with the -addalpha option, you can prepare a dataset which doesn't report nodata value but is transparent in areas with no data.
-srcnodata value [value...]:
(starting with GDAL 1.7.0) Set nodata values for input bands (different values can be supplied for each band). If more than one value is supplied all values should be quoted to keep them together as a single operating system argument. If the option is not specified, the instrinsic nodata settings on the source datasets will be used (if they exist). The value set by this option is written in the NODATA element of each ComplexSource element. Use a value of None to ignore intrinsic nodata settings on the source datasets.
-vrtnodata value [value...]:
(starting with GDAL 1.7.0) Set nodata values at the VRT band level (different values can be supplied for each band). If more than one value is supplied all values should be quoted to keep them together as a single operating system argument. If the option is not specified, instrinsic nodata settings on the first dataset will be used (if they exist). The value set by this option is written in the NoDataValue element of each VRTRasterBand element. Use a value of None to ignore intrinsic nodata settings on the source datasets.
-separate:
(starting with GDAL 1.7.0) Place each input file into a separate stacked band. In that case, only the first band of each dataset will be placed into a new band. Contrary to the default mode, it is not required that all bands have the same datatype.
-allow_projection_difference:
(starting with GDAL 1.7.0) When this option is specified, the utility will accept to make a VRT even if the input datasets have not the same projection. Note: this does not mean that they will be reprojected. Their projection will just be ignored.
-input_file_list:
To specify a text file with an input filename on each line
-q:
(starting with GDAL 1.7.0) To disable the progress bar on the console
\section gdalbuildvrt_example EXAMPLE \htmlonly Example: \endhtmlonly \verbatim gdalbuildvrt doq_index.vrt doq/*.tif gdalbuildvrt -input_file_list my_liste.txt doq_index.vrt gdalbuildvrt -separate rgb.vrt red.tif green.tif blue.tif \endverbatim \if man \section gdalbuildvrt_author AUTHOR Even Rouault \endif */ ******************************************************************************* /*! \page gdal_contour gdal_contour builds vector contour lines from a raster elevation model \section gdal_contour_synopsis SYNOPSIS \verbatim Usage: gdal_contour [-b ] [-a ] [-3d] [-inodata] [-snodata n] [-f ] [-i ] [-off ] [-fl ...] [-nln ] \endverbatim \section gdal_contour_description DESCRIPTION This program generates a vector contour file from the input raster elevation model (DEM). Starting from version 1.7 the contour line-strings will be oriented consistently. The high side will be on the right, i.e. a line string goes clockwise around a top.
-b band:
picks a particular band to get the DEM from. Defaults to band 1.
-a name:
provides a name for the attribute in which to put the elevation. If not provided no elevation attribute is attached.
-3d:
Force production of 3D vectors instead of 2D. Includes elevation at every vertex.
-inodata:
Ignore any nodata value implied in the dataset - treat all values as valid.
-snodata value:
Input pixel value to treat as "nodata".
-f format:
create output in a particular format, default is shapefiles.
-i interval:
elevation interval between contours.
-off offset:
Offset from zero relative to which to interpret intervals.
-fl level:
Name one or more "fixed levels" to extract.
-nln outlayername:
Provide a name for the output vector layer. Defaults to "contour".
\section gdal_contour_example EXAMPLE This would create 10meter contours from the DEM data in dem.tif and produce a shapefile in contour.shp/shx/dbf with the contour elevations in the "elev" attribute. \verbatim gdal_contour -a elev dem.tif contour.shp -i 10.0 \endverbatim \if man \section gdal_contour_author AUTHORS Frank Warmerdam , Silke Reimer \endif */ ******************************************************************************* /*! \page gdal_rasterize gdal_rasterize burns vector geometries into a raster \section zsynopsis SYNOPSIS \verbatim Usage: gdal_rasterize [-b band] [-i] [-at] [-burn value] | [-a attribute_name] [-3d] [-l layername]* [-where expression] [-sql select_statement] \endverbatim \section zdescription DESCRIPTION This program burns vector geometries (points, lines and polygons) into the raster band(s) of a raster image. Vectors are read from OGR supported vector formats. Note that the vector data must in the same coordinate system as the raster data, on the fly reprojection is not provided.
-b band:
The band(s) to burn values into. Multiple -b arguments may be used to burn into a list of bands. The default is to burn into band 1.
-i:
Invert rasterization. Burn the fixed burn value, or the burn value associated with the first feature into all parts of the image not inside the provided a polygon.
-at:
Enables the ALL_TOUCHED rasterization option so that all pixels touched by lines or polygons will be updated not just those one the line render path, or whose center point is within the polygon. Defaults to disabled for normal rendering rules.
-burn value:
A fixed value to burn into a band for all objects. A list of -burn options can be supplied, one per band being written to.
-a attribute_name:
Identifies an attribute field on the features to be used for a burn in value. The value will be burned into all output bands.
-3d:
Indicates that a burn value should be extracted from the "Z" values of the feature. These values are adjusted by the burn value given by "-burn value" or "-a attribute_name" if provided. As of now, only points and lines are drawn in 3D.
-l layername:
Indicates the layer(s) from the datasource that will be used for input features. May be specified multiple times, but at least one layer name or a -sql option must be specified.
-where expression:
An optional SQL WHERE style query expression to be applied to select features to burn in from the input layer(s).
-sql select_statement:
An SQL statement to be evaluated against the datasource to produce a virtual layer of features to be burned in.
src_datasource:
Any OGR supported readable datasource.
dst_filename:
The GDAL supported output file. Must support update mode access. Currently gdal_rasterize cannot create new output files though that may be added eventually.
\section zexample EXAMPLE The following would burn all polygons from mask.shp into the RGB TIFF file work.tif with the color red (RGB = 255,0,0). \verbatim gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 0 -burn 0 -l mask mask.shp work.tif \endverbatim The following would burn all "class A" buildings into the output elevation file, pulling the top elevation from the ROOF_H attribute. \verbatim gdal_rasterize -a ROOF_H -where 'class="A"' -l footprints footprints.shp city_dem.tif \endverbatim \if man \section zauthor AUTHORS Frank Warmerdam \endif */ ******************************************************************************* /*! \page rgb2pct rgb2pct.py Convert a 24bit RGB image to 8bit paletted \section rsynopsis SYNOPSIS \verbatim rgb2pct.py [-n colors | -pct palette_file] [-of format] source_file dest_file \endverbatim \section rdescription DESCRIPTION This utility will compute an optimal pseudo-color table for a given RGB image using a median cut algorithm on a downsampled RGB histogram. Then it converts the image into a pseudo-colored image using the color table. This conversion utilizes Floyd-Steinberg dithering (error diffusion) to maximize output image visual quality.
-n colors:
Select the number of colors in the generated color table. Defaults to 256. Must be between 2 and 256.
-pct palette_file:
Extract the color table from palette_file instead of computing it. Can be used to have a consistant color table for multiple files.
-of format:
Format to generated (defaults to GeoTIFF). Same semantics as the -of flag for gdal_translate. Only output formats supporting pseudocolor tables should be used.
source_file:
The input RGB file.
dest_file:
The output pseudo-colored file that will be created.
NOTE: rgb2pct.py is a Python script, and will only work if GDAL was built with Python support. \if man \section iauthor AUTHOR Frank Warmerdam \endif */ ******************************************************************************* /*! \page pct2rgb pct2rgb.py Convert an 8bit paletted image to 24bit RGB \section psynopsis SYNOPSIS \htmlonly Usage: \endhtmlonly \verbatim pct2rgb.py [-of format] [-b band] source_file dest_file \endverbatim \section pdescription DESCRIPTION This utility will convert a pseudocolor band on the input file into an output RGB file of the desired format.
-of format:
Format to generated (defaults to GeoTIFF).
-b band:
Band to convert to RGB, defaults to 1.
source_file:
The input file.
dest_file:
The output RGB file that will be created.
NOTE: pct2rgb.py is a Python script, and will only work if GDAL was built with Python support. The new '-expand rgb|rgba' option of gdal_translate obsoletes that utility. \if man \section pauthor AUTHORS Frank Warmerdam , Silke Reimer \endif */ ******************************************************************************* /*! \page gdaltransform gdaltransform transforms coordinates \section fsynopsis SYNOPSIS \verbatim gdaltransform [--help-general] [-i] [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"] [-order n] [-tps] [-rpc] [-geoloc] [-gcp pixel line easting northing [elevation]]* [srcfile [dstfile]] \endverbatim \section fdescription DESCRIPTION The gdaltransform utility reprojects a list of coordinates into any supported projection,including GCP-based transformations.
-s_srs srs def:
source spatial reference set. The coordinate systems that can be passed are anything supported by the OGRSpatialReference.SetFromUserInput() call, which includes EPSG PCS and GCSes (ie. EPSG:4296), PROJ.4 declarations (as above), or the name of a .prf file containing well known text.
-t_srs srs_def:
target spatial reference set. The coordinate systems that can be passed are anything supported by the OGRSpatialReference.SetFromUserInput() call, which includes EPSG PCS and GCSes (ie. EPSG:4296), PROJ.4 declarations (as above), or the name of a .prf file containing well known text.
-to NAME=VALUE:
set a transformer option suitable to pass to GDALCreateGenImgProjTransformer2().
-order n:
order of polynomial used for warping (1 to 3). The default is to select a polynomial order based on the number of GCPs.
-tps:
Force use of thin plate spline transformer based on available GCPs.
-rpc:
Force use of RPCs.
-geoloc:
Force use of Geolocation Arrays.
-i
Inverse transformation: from destination to source.
-gcppixel line easting northing [elevation]:
Provide a GCP to be used for transformation (generally three or more are required)
srcfile:
File with source projection definition or GCP's. If not given, source projection is read from the command-line -s_srs or -gcp parameters
dstfile:
File with destination projection definition.
Coordinates are read as pairs (or triples) of numbers per line from standard input, transformed, and written out to standard output in the same way. All transformations offered by gdalwarp are handled, including gcp-based ones. Note that input and output must always be in decimal form. There is currently no support for DMS input or output. If an input image file is provided, input is in pixel/line coordinates on that image. If an output file is provided, output is in pixel/line coordinates on that image. \section fexample Reprojection Example Simple reprojection from one projected coordinate system to another: \verbatim gdaltransform -s_srs EPSG:28992 -t_srs EPSG:31370 177502 311865 \endverbatim Produces the following output in meters in the "Belge 1972 / Belgian Lambert 72" projection: \verbatim 244510.77404604 166154.532871342 -1046.79270555763 \endverbatim \section gexample Image RPC Example The following command requests an RPC based transformation using the RPC model associated with the named file. Because the -i (inverse) flag is used, the transformation is from output georeferenced (WGS84) coordinates back to image coordinates. \verbatim gdaltransform -i -rpc 06OCT20025052-P2AS-005553965230_01_P001.TIF 125.67206 39.85307 50 \endverbatim Produces this output measured in pixels and lines on the image: \verbatim 3499.49282422381 2910.83892848414 50 \endverbatim \if man \section fauthor AUTHORS Frank Warmerdam , Jan Hartmann \endif */ ******************************************************************************* /*! \page nearblack nearblack convert nearly black/white borders to black \section msynopsis SYNOPSIS \verbatim nearblack [-white] [-near dist] [-nb non_black_pixels] [-o outfile] infile \endverbatim \section mdescription DESCRIPTION This utility will scan an image and try to set all pixels that are nearly black (or nearly white) around the collar to exactly black (or white). This is often used to "fix up" lossy compressed airphotos so that color pixels can be treated as transparent when mosaicing.
-o outfile:
The name of the output file to be created. Newly created files are currently always created with the HFA driver (Erdas Imagine - .img)
-white:
Search for nearly white (255) pixels instead of nearly black pixels.
-near dist:
Select how far from black (or white) the pixel values can be and still considered near black (white). Defaults to 15.
-nb non_black_pixels:
number of non-black pixels that can be encountered before the giving up search inwards. Defaults to 2.
infile:
The input file. Any GDAL supported format, any number of bands, normally 8bit Byte bands.
The algorithm processes the image one scanline at a time. A scan "in" is done from either end setting pixels to black (white) until at least "non_black_pixels" pixels that are more than "dist" gray levels away from black (white) have been encountered at which point the scan stops. The nearly black (white) pixels are set to black (white). The algorithm also scans from top to bottom and from bottom to top to identify indentations in the top or bottom. The processing is all done in 8bit (Bytes). If the output file is omitted, the processed results will be written back to the input file - which must support update. \if man \section mauthor AUTHORS Frank Warmerdam \endif */ ******************************************************************************* /*! \page gdal_merge gdal_merge.py mosaics a set of images \section gsynopsis SYNOPSIS \verbatim gdal_merge.py [-o out_filename] [-of out_format] [-co NAME=VALUE]* [-ps pixelsize_x pixelsize_y] [-separate] [-v] [-pct] [-ul_lr ulx uly lrx lry] [-n nodata_value] [-init "value [value...]"] [-ot datatype] [-createonly] input_files \endverbatim \section gdescription DESCRIPTION This utility will automatically mosaic a set of images. All the images must be in the same coordinate system and have a matching number of bands, but they may be overlapping, and at different resolutions. In areas of overlap, the last image will be copied over earlier ones.
-o out_filename:
The name of the output file, which will be created if it does not already exist (defaults to "out.tif").
-of format:
Output format, defaults to GeoTIFF (GTiff).
-co NAME=VALUE:
Creation option for output file. Multiple options can be specified.
-ot datatype:
Force the output image bands to have a specific type. Use type names (ie. Byte, Int16,...)
-ps pixelsize_x pixelsize_y:
Pixel size to be used for the output file. If not specified the resolution of the first input file will be used.
-ul_lr ulx uly lrx lry:
The extents of the output file. If not specified the aggregate extents of all input files will be used.
-v:
Generate verbose output of mosaicing operations as they are done.
-separate:
Place each input file into a separate stacked band.
-pct:
Grab a pseudocolor table from the first input image, and use it for the output. Merging pseudocolored images this way assumes that all input files use the same color table.
-n nodata_value:
Ignore pixels from files being merged in with this pixel value.
-init value:
Pre-initialize the output image bands with these values. However, it is not marked as the nodata value in the output file. If only one value is given, the same value is used in all the bands.
-createonly:
The output file is created (and potentially pre-initialized) but no input image data is copied into it.
NOTE: gdal_merge.py is a Python script, and will only work if GDAL was built with Python support. \if man \section gauthor AUTHORS Frank Warmerdam , Silke Reimer \endif */ ******************************************************************************* /*! \page gdal2tiles gdal2tiles.py generates directory with TMS tiles, KMLs and simple web viewers \section gdal2tiles_synopsis SYNOPSIS \verbatim gdal2tiles.py [-title "Title"] [-publishurl http://yourserver/dir/] [-nogooglemaps] [-noopenlayers] [-nokml] [-googlemapskey KEY] [-forcekml] [-v] input_file [output_dir] \endverbatim \section gdal2tiles_description DESCRIPTION This utility generates a directory with small tiles and metadata, following OSGeo Tile Map Service Specification. Simple web pages with viewers based on Google Maps and OpenLayers are generated as well - so anybody can comfortably explore your maps on-line and you do not need to install or configure any special software (like mapserver) and the map displays very fast in the webbrowser. You only need to upload generated directory into a web server. GDAL2Tiles creates also necessary metadata for Google Earth (KML SuperOverlay), in case the supplied map uses EPSG:4326 projection. World files and embedded georeference is used during tile generation, but you can publish a picture without proper georeference too.
-title "Title":
Title used for generated metadata, web viewers and KML files.
-publishurl http://yourserver/dir/:
Address of a directory into which you are going to upload the result. It should end with slash.
-nogooglemaps:
Do not generate Google Maps based html page.
-noopenlayers:
Do not generate OpenLayers based html page.
-nokml:
Do not generate KML files for Google Earth.
-googlemapskey KEY:
Key for your domain generated on Google Maps API web page (http://www.google.com/apis/maps/signup.html).
-forcekml
Force generating of KML files. Input file must use EPSG:4326 coordinates!
-v
Generate verbose output of tile generation.
NOTE: gdal2tiles.py is a Python script that needs to be run against "new generation" Python GDAL binding. \if man \section gdal2tiles_author AUTHORS Klokan Petr Pridal as a Google SoC 2007 Project. \endif */ ******************************************************************************* /*! \page gdal-config gdal-config determines various information about a GDAL installation \section csynopsis SYNOPSIS \verbatim gdal-config [OPTIONS] Options: [--prefix[=DIR]] [--libs] [--cflags] [--version] [--ogr-enabled] [--formats] \endverbatim \section cdescription DESCRIPTION This utility script (available on Unix systems) can be used to determine various information about a GDAL installation. It is normally just used by configure scripts for applications using GDAL but can be queried by an end user.
--prefix:
the top level directory for the GDAL installation.
--libs:
The libraries and link directives required to use GDAL.
--cflags:
The include and macro definition required to compiled modules using GDAL.
--version:
Reports the GDAL version.
--ogr-enabled:
Reports "yes" or "no" to standard output depending on whether OGR is built into GDAL.
--formats:
Reports which formats are configured into GDAL to stdout.
*/ ******************************************************************************* /*! \page gdal_retile gdal_retile.py gdal_retile.py retiles a set of tiles and/or build tiled pyramid levels \if man \section retile_synopsis SYNOPSIS \endif \htmlonly Usage: \endhtmlonly \verbatim gdal_retile.py [-v] [-co NAME=VALUE]* [-of out_format] [-ps pixelWidth pixelHeight] [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/ CInt16/CInt32/CFloat32/CFloat64}]' [ -tileIndex tileIndexName [-tileIndexField tileIndexFieldName]] [ -csv fileName [-csvDelim delimiter]] [-s_srs srs_def] [-pyramidOnly] [-r {near/bilinear/cubic/cubicspline/lanczos}] -levels numberoflevels -targetDir TileDirectory input_files \endverbatim \if man \section retile_description DESCRIPTION \endif This utility will retile a set of input tile(s). All the input tile(s) must be georeferenced in the same coordinate system and have a matching number of bands. Optionally pyramid levels are generated. It is possible to generate shape file(s) for the tiled output. If your number of input tiles exhausts the command line buffer, use the general --optfile option
-targetDir directory:
The Directory where the tile result is created. Pyramids are stored in subdirs numbered from 1. Created tile names have a numbering schema and contain the name of the source tiles(s)
-of format:
Output format, defaults to GeoTIFF (GTiff).
-co NAME=VALUE:
Creation option for output file. Multiple options can be specified.
-ot datatype:
Force the output image bands to have a specific type. Use type names (ie. Byte, Int16,...)
-ps pixelsize_x pixelsize_y:
Pixel size to be used for the output file. If not specified, 256 x 256 is the default
-levels numberOfLevels:
Number of pyramids levels to build.
-v:
Generate verbose output of tile operations as they are done.
-pyramidOnly:
No retiling, build only the pyramids
-r algorithm:
Resampling algorithm, default is near
-s_srs srs_def:
Source spatial reference to use. The coordinate systems that can be passed are anything supported by the OGRSpatialReference.SetFro‐mUserInput() call, which includes EPSG PCS and GCSes (ie.EPSG:4296), PROJ.4 declarations (as above), or the name of a .prf file containing well known text. If no srs_def is given, the srs_def of the source tiles is used (if there is any). The srs_def will be propageted to created tiles (if possible) and to the optional shape file(s)
-tileIndex tileIndexName:
The name of shape file containing the result tile(s) index
-tileIndexField tileIndexFieldName:
The name of the attribute containing the tile name
-csv csvFileName:
The name of the csv file containing the tile(s) georeferencing information. The file contains 5 columns: tilename,minx,maxx,miny,maxy
-csvDelim column delimiter:
The column delimter used in the csv file, default value is a semicolon ";"
NOTE: gdal_merge.py is a Python script, and will only work if GDAL was built with Python support. \if man \section retile_author AUTHORS Christian Mueller \endif */ ******************************************************************************* /*! \page gdal_grid gdal_grid creates regular grid from the scattered data \section gdal_grid_synopsis SYNOPSIS \verbatim Usage: gdal_grid [--help-general] [--formats] [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/ CInt16/CInt32/CFloat32/CFloat64}] [-of format] [-co "NAME=VALUE"] [-zfield field_name] [-a_srs srs_def] [-spat xmin ymin xmax ymax] [-l layername]* [-where expression] [-sql select_statement] [-txe xmin xmax] [-tye ymin ymax] [-outsize xsize ysize] [-a algorithm[:parameter1=value1]*] [-q] \endverbatim \section gdal_grid_description DESCRIPTION This program creates regular grid (raster) from the scattered data read from the OGR datasource. Input data will be interpolated to fill grid nodes with values, you can choose from various interpolation methods.
-ot type:
For the output bands to be of the indicated data type.
-of format:
Select the output format. The default is GeoTIFF (GTiff). Use the short format name.
-txe xmin xmax:
Set georeferenced X extents of output file to be created.
-tye ymin ymax:
Set georeferenced Y extents of output file to be created.
-outsize xsize ysize:
Set the size of the output file in pixels and lines.
-a_srs srs_def:
Override the projection for the output file. The srs_def may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file containing the WKT.
-zfield field_name:
Identifies an attribute field on the features to be used to get a Z value from. This value overrides Z value read from feature geometry record (naturally, if you have a Z value in geometry, otherwise you have no choice and should specify a field name containing Z value).
-a [algorithm[:parameter1=value1][:parameter2=value2]...]:
Set the interpolation algorithm or data metric name and (optionally) its parameters. See \ref gdal_grid_algorithms and \ref gdal_grid_metrics sections for further discussion of available options.
-spat xmin ymin xmax ymax:
Adds a spatial filter to select only features contained within the bounding box described by (xmin, ymin) - (xmax, ymax).
-clipsrc [xmin ymin xmax ymax]|WKT|datasource|spat_extent:
Adds a spatial filter to select only features contained within the specified bounding box (expressed in source SRS), WKT geometry (POLYGON or MULTIPOLYGON), from a datasource or to the spatial extent of the -spat option if you use the spat_extent keyword. When specifying a datasource, you will generally want to use it in combination of the -clipsrclayer, -clipsrcwhere or -clipsrcsql options.
-clipsrcsql sql_statement:
Select desired geometries using an SQL query instead.
-clipsrclayer layername:
Select the named layer from the source clip datasource.
-clipsrcwhere expression:
Restrict desired geometries based on attribute query.
-l layername:
Indicates the layer(s) from the datasource that will be used for input features. May be specified multiple times, but at least one layer name or a -sql option must be specified.
-where expression:
An optional SQL WHERE style query expression to be applied to select features to process from the input layer(s).
-sql select_statement:
An SQL statement to be evaluated against the datasource to produce a virtual layer of features to be processed.
-co "NAME=VALUE":
Passes a creation option to the output format driver. Multiple -co options may be listed. See format specific documentation for legal creation options for each format.
-q:
Suppress progress monitor and other non-error output.
src_datasource:
Any OGR supported readable datasource.
dst_filename:
The GDAL supported output file.
\section gdal_grid_algorithms INTERPOLATION ALGORITHMS There are number of interpolation algorithms to choose from. \subsection gdal_grid_algorithms_invdist invdist Inverse distance to a power. This is default algorithm. It has following parameters:
power:
Weighting power (default 2.0).
smoothing:
Smoothing parameter (default 0.0).
radius1:
The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.
radius2:
The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.
angle:
Angle of search ellipse rotation in degrees (counter clockwise, default 0.0).
max_points:
Maximum number of data points to use. Do not search for more points than this number. This is only used if search ellipse is set (both radiuses are non-zero). Zero means that all found points should be used. Default is 0.
min_points:
Minimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker. This is only used if search ellipse is set (both radiuses are non-zero). Default is 0.
nodata:
NODATA marker to fill empty points (default 0.0).
\subsection gdal_grid_algorithms_average average Moving average algorithm. It has following parameters:
radius1:
The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.
radius2:
The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.
angle:
Angle of search ellipse rotation in degrees (counter clockwise, default 0.0).
min_points:
Minimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker. Default is 0.
nodata:
NODATA marker to fill empty points (default 0.0).
Note, that it is essential to set search ellipse for moving average method. It is a window that will be averaged when computing grid nodes values. \subsection gdal_grid_algorithms_nearest nearest Nearest neighbor algorithm. It has following parameters:
radius1:
The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.
radius2:
The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.
angle:
Angle of search ellipse rotation in degrees (counter clockwise, default 0.0).
nodata:
NODATA marker to fill empty points (default 0.0).
\section gdal_grid_metrics DATA METRICS Besides the interpolation functionality \ref gdal_grid can be used to compute some data metrics using the specified window and output grid geometry. These metrics are:
minimum:
Minimum value found in grid node search ellipse.
maximum:
Maximum value found in grid node search ellipse.
range:
A difference between the minimum and maximum values found in grid node search ellipse.
count:
A number of data points found in grid node search ellipse.
average_distance:
An average distance between the grid node (center of the search ellipse) and all of the data points found in grid node search ellipse.
average_distance_pts:
An average distance between the data points found in grid node search ellipse. The distance between each pair of points within ellipse is calculated and average of all distances is set as a grid node value.
All the metrics have the same set of options:
radius1:
The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.
radius2:
The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.
angle:
Angle of search ellipse rotation in degrees (counter clockwise, default 0.0).
min_points:
Minimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker. This is only used if search ellipse is set (both radiuses are non-zero). Default is 0.
nodata:
NODATA marker to fill empty points (default 0.0).
\section gdal_grid_csv READING COMMA SEPARATED VALUES Often you have a text file with a list of comma separated XYZ values to work with (so called CSV file). You can easily use that kind of data source in \ref gdal_grid. All you need is create a virtual dataset header (VRT) for you CSV file and use it as input datasource for \ref gdal_grid. You can find details on VRT format at Virtual Format description page. Here is a small example. Let we have a CSV file called dem.csv containing \verbatim Easting,Northing,Elevation 86943.4,891957,139.13 87124.3,892075,135.01 86962.4,892321,182.04 87077.6,891995,135.01 ... \endverbatim For above data we will create dem.vrt header with the following content: \verbatim dem.csv wkbPoint \endverbatim This description specifies so called 2.5D geometry with three coordinates X, Y and Z. Z value will be used for interpolation. Now you can use dem.vrt with all OGR programs (start with \ref ogrinfo to test that everything works fine). The datasource will contain single layer called "dem" filled with point features constructed from values in CSV file. Using this technique you can handle CSV files with more than three columns, switch columns, etc. If your CSV file does not contain column headers then it can be handled in the following way: \verbatim \endverbatim Comma Separated Value description page contains details on CSV format supported by GDAL/OGR. \section gdal_grid_example EXAMPLE The following would create raster TIFF file from VRT datasource described in \ref gdal_grid_csv section using the inverse distance to a power method. Values to interpolate will be read from Z value of geometry record. \verbatim gdal_grid -a invdist:power=2.0:smoothing=1.0 -txe 85000 89000 -tye 894000 890000 -outsize 400 400 -of GTiff -ot Float64 -l dem dem.vrt dem.tiff \endverbatim The next command does the same thing as the previos one, but reads values to interpolate from the attribute field specified with -zfield option instead of geometry record. So in this case X and Y coordinates are being taken from geometry and Z is being taken from the "Elevation" field. \verbatim gdal_grid -zfield "Elevation" -a invdist:power=2.0:smoothing=1.0 -txe 85000 89000 -tye 894000 890000 -outsize 400 400 -of GTiff -ot Float64 -l dem dem.vrt dem.tiff \endverbatim \if man \section gdal_grid_author AUTHORS Andrey Kiselev \endif */ ******************************************************************************* /*! \page gdaldem gdaldem Tools to analyze and visualize DEMs. (since GDAL 1.7.0) \section gdaldem_synopsis SYNOPSIS \htmlonly Usage: \endhtmlonly \verbatim - To generate a shaded relief map from any GDAL-supported elevation raster : gdaldem hillshade input_dem output_hillshade [-z ZFactor (default=1)] [-s scale* (default=1)]" [-az Azimuth (default=315)] [-alt Altitude (default=45)] [-b Band (default=1)] [-of format] [-co "NAME=VALUE"]* [-q] - To generate a slope map from any GDAL-supported elevation raster : gdaldem slope input_dem output_slope_map" [-p use percent slope (default=degrees)] [-s scale* (default=1)] [-b Band (default=1)] [-of format] [-co "NAME=VALUE"]* [-q] - To generate an aspect map from any GDAL-supported elevation raster Outputs a 32-bit float raster with pixel values from 0-360 indicating azimuth : gdaldem aspect input_dem output_aspect_map" [-trigonometric] [-zero_for_flat] [-b Band (default=1)] [-of format] [-co "NAME=VALUE"]* [-q] - To generate a color relief map from any GDAL-supported elevation raster gdaldem color-relief input_dem color_text_file output_color_relief_map [-alpha] [-exact_color_entry | -nearest_color_entry] [-b Band (default=1)] [-of format] [-co "NAME=VALUE"]* [-q] where color_text_file contains lines of the format "elevation_value red green blue" - To generate a Terrain Ruggedness Index (TRI) map from any GDAL-supported elevation raster: gdaldem TRI input_dem output_TRI_map [-b Band (default=1)] [-of format] [-q] - To generate a Topographic Position Index (TPI) map from any GDAL-supported elevation raster: gdaldem TPI input_dem output_TPI_map [-b Band (default=1)] [-of format] [-q] - To generate a roughness map from any GDAL-supported elevation raster: gdaldem roughness input_dem output_roughness_map [-b Band (default=1)] [-of format] [-q] Notes : Scale is the ratio of vertical units to horizontal for Feet:Latlong use scale=370400, for Meters:LatLong use scale=111120) \endverbatim \if man \section gdaldem_description DESCRIPTION \endif This utility has 7 different modes :
\ref gdaldem_hillshade
to generate a shaded relief map from any GDAL-supported elevation raster
\ref gdaldem_slope
to generate a slope map from any GDAL-supported elevation raster
\ref gdaldem_aspect
to generate an aspect map from any GDAL-supported elevation raster
\ref gdaldem_color_relief
to generate a color relief map from any GDAL-supported elevation raster
\ref gdaldem_TRI
to generate a map of Terrain Ruggedness Index from any GDAL-supported elevation raster
\ref gdaldem_TPI
to generate a map of Topographic Position Index from any GDAL-supported elevation raster
\ref gdaldem_roughness
to generate a map of roughness from any GDAL-supported elevation raster
The following general options are available :
input_dem:
The input DEM raster to be processed
output_xxx_map:
The output raster produced
-of format:
Select the output format. The default is GeoTIFF (GTiff). Use the short format name.
-b band:
Select an input band to be processed. Bands are numbered from 1.
-co "NAME=VALUE":
Passes a creation option to the output format driver. Multiple -co options may be listed. See format specific documentation for legal creation options for each format.
-q:
Suppress progress monitor and other non-error output.
\section gdaldem_modes Modes \subsection gdaldem_hillshade hillshade This command outputs an 8-bit raster with a nice shaded relief effect. It’s very useful for visualizing the terrain. You can optionally specify the azimuth and altitude of the light source, a vertical exaggeration factor and a scaling factor to account for differences between vertical and horizontal units. The following specific options are available :
-z zFactor:
vertical exaggeration used to pre-multiply the elevations
-s scale:
ratio of vertical units to horizontal. 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)
-az 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.
-alt altitude:
altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light.
\subsection gdaldem_slope slope This command will take a DEM raster and output a 32-bit float raster with slope values. You have the option of specifying the type of slope value you want: degrees or percent slope. In cases where the horizontal units differ from the vertical units, you can also supply a scaling factor. The following specific options are available :
-p :
if specified, the slope will be expressed as percent slope. Otherwise, it is expressed as degrees
-s scale:
ratio of vertical units to horizontal. 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)
\subsection gdaldem_aspect aspect This command outputs a 32-bit float raster with values between 0° and 360° representing the azimuth that slopes are facing. The definition of the azimuth is such that : 0° means that the slope is facing the North, 90° it's facing the East, 180° it's facing the South and 270° it's facing the West (provided that the top of your input raster is north oriented). The aspect value -9999 is used as the nodata value to indicate undefined aspect in flat areas with slope=0. The following specifics options are available :
-trigonometric:
return trigonometric angle instead of azimuth. Thus 0° means East, 90° North, 180° West, 270° South
-zero_for_flat:
return 0 for flat areas with slope=0, instead of -9999
By using those 2 options, the aspect returned by gdaldem aspect should be identical to the one of GRASS r.slope.aspect. Otherwise, it's identical to the one of Matthew Perry's aspect.cpp utility. \subsection gdaldem_color_relief color-relief This command outputs a 3-band (RGB) or 4-band (RGBA) raster with values are computed from the elevation and a text-based color configuration file, containing the association between various elevation values and the corresponding wished color. By default, the colors between the given elevation values are blended smoothly and the result is a nice colorized DEM. The -exact_color_entry or -nearest_color_entry options can be used to avoid that linear interpolation for values that don't match an index of the color configuration file. The following specifics options are available :
color_text_file:
text-based color configuration file
-alpha :
add an alpha channel to the output raster
-exact_color_entry :
use strict matching when searching in the color configuration file. If none matching color entry is found, the "0,0,0,0" RGBA quadruplet will be used
-nearest_color_entry :
use the RGBA quadruplet corresponding to the closest entry in the color configuration file.
The color-relief mode is the only mode that supports VRT as output format. In that case, it will translate the color configuration file into appropriate elements. Note that elevations specified as percentage will be translated as absolute values, which must be taken into account when the statistics of the source raster differ from the one that was used when building the VRT. The text-based color configuration file generally contains 4 columns per line : the elevation value and the corresponding Red, Green, Blue component (between 0 and 255). The elevation value can be any floating point value, or the nv keyword for the nodata value.. The elevation can also be expressed as a percentage : 0% being the minimum value found in the raster, 100% the maximum value. An extra column can be optionnaly added for the alpha component. If it is not specified, full opacity (255) is assumed. Various field separators are accepted : comma, tabulation, spaces, ':'. 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. 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 tablulations and commma as separators are GDAL specific extensions. For example : \verbatim 3500 white 2500 235:220:175 50% 190 185 135 700 240 250 150 0 50 180 50 nv 0 0 0 0 \endverbatim \subsection gdaldem_TRI TRI This command outputs a single-band raster with values computed from the elevation. TRI stands for Terrain Ruggedness Index, which is defined as the mean difference between a central pixel and its surrounding cells (see Wilson et al 2007, Marine Geodesy 30:3-35). There are no specific options. \subsection gdaldem_TPI TPI This command outputs a single-band raster with values computed from the elevation. TPI stands for Topographic Position Index, which is defined as the difference between a central pixel and the mean of its surrounding cells (see Wilson et al 2007, Marine Geodesy 30:3-35). There are no specific options. \subsection gdaldem_roughness roughness This command outputs a single-band raster with values computed from the elevation. Roughness is the the largest inter-cell difference of a central pixel and its surrounding cell, as defined in Wilson et al (2007, Marine Geodesy 30:3-35). There are no specific options. \section gdaldem_author AUTHORS Matthew Perry , Even Rouault , Howard Butler , Chris Yesson Derived from code by Michael Shapiro, Olga Waupotitsch, Marjorie Larson, Jim Westervelt : U.S. Army CERL, 1993. GRASS 4.1 Reference Manual. U.S. Army Corps of Engineers, Construction Engineering Research Laboratories, Champaign, Illinois, 1-425. \section gdaldem_seealso See also Documentation of related GRASS utilities : http://grass.osgeo.org/grass64/manuals/html64_user/r.slope.aspect.html http://grass.osgeo.org/grass64/manuals/html64_user/r.shaded.relief.html http://grass.osgeo.org/grass64/manuals/html64_user/r.colors.html */