The following utility programs are distributed with GDAL.
The gdalinfo program lists various information about a GDAL supported raster dataset.
Usage: gdalinfo [-mm] datasetname
The -mm switch will force computation of the actual min/max values for each band in the dataset.
The gdalinfo will report all of the following (if known):
Example:
warmerda@gdal[138]% 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
The gdal_translate utility can be used to convert raster data between different formats, potentially peforming some operations like subsettings, resampling, and rescaling pixels in the process.
Usage: gdal_translate
[-ot {Byte/UInt16/UInt32/Int32/Float32/Float64/CInt16/
CInt32/CFloat32/CFloat64}] [-not_strict]
[-of format] [-b band] [-outsize xsize[%] ysize[%]]
[-scale [src_min src_max [dst_min dst_max]]]
[-srcwin xoff yoff xsize ysize] [-a_srs srs_def]
[-projwin xoff yoff xsize ysize] [-co "NAME=VALUE"]*
src_dataset dst_dataset
Example:
% gdal_translate -of GTiff -co "TILED=YES" utm.tif utm_tiled.tif
The gdaladdo utility can be used to build or rebuild overview images for most supported file formats with one over several downsampling algorithms.
Usage: gdaladdo [-r {nearest,average,average_mp,average_magphase,mode}]
filename levels
Example:
% gdaladdo -r average abc.tif 2 4 8 16
Mode is not actually implemented, and 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.
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. The GeoTIFF driver stores overviews internally to the file operated on.
The gdalwarp utility is a simple image reprojection and warping utility. The program can reproject to any support projection, and can also apply GCPs stored with the image if the image is "raw" with control information.
Usage: gdalwarp [--version] [--formats]
[-s_srs srs_def] [-t_srs srs_def] [-order n] [-et err_threshold]
[-te xmin ymin xmax ymax] [-tr xres yres] [-ts width height]
[-of format] [-co "NAME=VALUE"]* srcfile dstfile
Mosaicing into an existing output file is supported if the output file already exists.
It currently has the following limitations:
Example: For instance, an eight bit spot scene stored in GeoTIFF with control points mapping the corners to lat/long could be warped to a UTM projection with a command like this:
% gdalwarp -t_srs '+proj=utm +zone=11 +datum=WGS84' raw_spot.tif utm11.tif
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 UMN MapServer as a raster tileindex.
Usage: gdaltindex [-tileindex field_name] index_file [gdal_file]* eg. % gdaltindex doq_index.shp doq/*.tif
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 the a pseudo-colored image using the color table. This conversion utilizes Floyd-Steinberg dithering (error diffusion) to maximize output image visual quality.
Usage: rgb2pct.py [-n colors] [-of format] source_file dest_file
NOTE: rgb2pct.py is a Python script, and will only work if GDAL was built with Python support. It is also not installed by default. It is found at $GDAL_HOME/pymod.
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.
Usage: gdal_merge.py [-o out_filename] [-f out_format] [-v]
[-ps pixelsize_x pixelsize_y]
[-ul_lr ulx uly lrx lry] input_files
NOTE: gdal_merge.py is a Python script, and will only work if GDAL was built with Python support. It is also not installed by default. It is found at $GDAL_HOME/pymod.
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.
Usage: gdal-config [OPTIONS]
Options:
[--prefix[=DIR]]
[--libs]
[--cflags]
[--version]
[--ogr-enabled]
[--formats]
1.2.3-20001105 written by Dimitri van Heesch,
© 1997-2000