gdal_utilities man page
— A collection of GDAL related programs.
The following utility programs are distributed with GDAL.
- gdalinfo — Report information about a file.
- gdal_translate — Copy a raster file, with control of output format.
- gdaladdo — Add overviews to a file.
- gdalwarp — Warp an image into a new coordinate system.
- gdaltindex — Build a MapServer raster tileindex.
- gdalbuildvrt — Build a VRT from a list of datasets.
- gdal_contour — Contours from DEM.
- gdaldem — Tools to analyze and visualize DEMs.
- rgb2pct — Convert a 24bit RGB image to 8bit paletted.
- pct2rgb — Convert an 8bit paletted image to 24bit RGB.
- gdal_merge — Build a quick mosaic from a set of images.
- gdal2tiles — Create a TMS tile structure, KML and simple web viewer.
- gdal_rasterize — Rasterize vectors into raster file.
- gdaltransform — Transform coordinates.
- nearblack — Convert nearly black/white borders to exact value.
- gdal_retile — Retiles a set of tiles and/or build tiled pyramid levels.
- gdal_grid — Create raster from the scattered data.
- gdal_proximity — Compute a raster proximity map.
- gdal_polygonize — Generate polygons from raster.
- gdal_sieve — Raster Sieve filter.
- gdal_fillnodata — Interpolate in nodata regions.
- gdallocationinfo — Query raster at a location.
- gdalsrsinfo — Report a given SRS in different formats. (GDAL >= 1.9.0)
- gdalmove — Transform the coordinate system of a file (GDAL >= 1.10)
- gdal_edit — Edit in place various information of an existing GDAL dataset (projection, geotransform, nodata, metadata)
- gdal_calc — Command line raster calculator with numpy syntax
- gdal_pansharpen — Perform a pansharpen operation.
- gdal-config — Get options required to build software using GDAL.
- gdalmanage — Identify, copy, rename and delete raster.
- gdalcompare — Compare two images and report on differences.
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 command line. 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 <format>' command line option but the web page for the format is the definitive source of information on driver creation options. See
format specific documentation for legal creation options for each format
- -a_srs SRS
Several utilities, (gdal_translate and gdalwarp) include the ability to specify coordinate systems with command line 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.
- NAD27/NAD83/WGS84/WGS72: These common geographic (lat/long) coordinate systems can be used directly by these names.
- EPSG:n: Coordinate systems (projected or geographic) can be selected based on their EPSG codes, for instance EPSG:27700 is the British National Grid. A list of EPSG coordinate systems can be found in the GDAL data files gcs.csv and pcs.csv.
- PROJ.4 Definitions: A PROJ.4 definition string can be used as a coordinate system. For instance '+proj=utm +zone=11 +datum=WGS84'. Take care to keep the proj.4 string together as a single argument to the command (usually by double quoting).
- OpenGIS Well Known Text: The Open GIS Consortium has defined a textual format for describing coordinate systems as part of the Simple Features specifications. This format is the internal working format for coordinate systems used in GDAL. The name of a file containing a WKT coordinate system definition may be used a coordinate system argument, or the entire coordinate system itself may be used as a command line option (though escaping all the quotes in WKT is quite challenging).
- ESRI Well Known Text: ESRI uses a slight variation on OGC WKT format in their ArcGIS product (ArcGIS .prj files), and these may be used in a similar manner to WKT files, but the filename should be prefixed with ESRI::. For example 'ESRI::NAD 1927 StatePlane Wyoming West FIPS 4904.prj'.
- Spatial References from URLs: For example http://spatialreference.org/ref/user/north-pacific-albers-conic-equal-area/.
- filename: The name of a file containing WKT, PROJ.4 strings, or XML/GML coordinate system definitions can be provided.
General Command Line Switches
All GDAL command line utility programs support the following 'general' options.
Report the version of GDAL and exit.
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 (i.e. supports CreateCopy); 'rw+' is read, write and update (i.e. supports Create). A 'v' is appended for formats supporting virtual IO (/vsimem, /vsigzip, /vsizip, etc). A 's' is appended for formats supporting subdatasets. Note: The valid formats for the output of gdalwarp are formats that support the Create() method (marked as rw+), not just the CreateCopy() method.
- --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 command line 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 keywordto 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.
Gives a brief usage message for the generic GDAL command line options and exit.