/*! 
\page gdal_utilities

<center>
<title>GDAL Utilities</title>
</center>

The following utility programs are distributed with GDAL.

\if man
lists information about a raster dataset
\section synopsis SYNOPSIS
\endif

\htmlonly
<h2><a name="gdalinfo">gdalinfo</a></h2>

Usage: 
\endhtmlonly

\verbatim
gdalinfo [--version] [--formats] [-mm] [-nogcp] [-nomd] datasetname
\endverbatim

\if man
\section description DESCRIPTION
\endif

The gdalinfo program lists various information about a GDAL supported
raster dataset. 
<dl>
<dt> <b>--version</b></dt><dd>Print version of the GDAL library and exit.</dd>
<dt> <b>--formats</b></dt><dd> Print a list of supported file formats.</dd>
<dt> <b>-mm</b></dt><dd> Force computation of the actual min/max values for each
band in the dataset.</dd>
<dt> <b>-nogcp</b></dt><dd> 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.</dd>
<dt> <b>-nomd</b></dt><dd> Suppress metadata printing. Some datasets may contain a lot
of metadata strings.</dd>
</dl>

The gdalinfo will report all of the following (if known):

<ul>
<li> The format driver used to access the file. 
<li> Raster size (in pixel and lines).
<li> The coordinate system for the file (in OGC WKT).
<li> The geotransform associated with the file (rotational coefficients are
currently not reported).  
<li> Corner coordinates in georeferenced, and if possible lat/long based on
the full geotransform (but not GCPs). 
<li> Ground control points.
<li> File wide (including subdatasets) metadata. 
<li> Band data types.
<li> Band color interpretations.
<li> Band block size.
<li> Band descriptions. 
<li> Band min/max values (internally known and possibly computed).
<li> Band NODATA value.
<li> Band overview resolutions available. 
<li> Band unit type (ie. "meters" or "feet" for elevation bands). 
<li> Band pseudo-color tables. 
</ul>

\if man
\section example EXAMPLE
\endif

\htmlonly
Example:
\endhtmlonly

\verbatim
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
\endverbatim


\if man
\section author AUTHOR
Frank Warmerdam <warmerdam@pobox.com>

converts raster data between different formats
\section synopsis SYNOPSIS
\endif

\htmlonly
<h2><a name="gdal_translate">gdal_translate</a></h2>
Usage:
\endhtmlonly

\verbatim
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"]*
       [-mo "META-TAG=VALUE"]* [-quiet]
       src_dataset dst_dataset
\endverbatim

\if man
\section description DESCRIPTION
\endif

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.

<dl>
<dt> <b>-ot</b>:</dt></dd> For the output bands to be of the indicated data
type.<dd>
<dt> <b>-not_strict</b>:</dt><dd> Be forgiving of mismatches and lost data
when
translating to the output format.</dd>
<dt> <b>-of</b> <i>format</i>:</dt><dd> Select the output format.  The default is 
GeoTIFF (GTiff).  Use the short format name.</dd>
<dt> <b>-b</b> <i>band</i>:</dt><dd> Select an input band <i>band</i> 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.</dd>
<dt> <b>-outsize</b> <i>xsize[%] ysize[%]</i>:</dt><dd> 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.</dd>
<dt> <b>-scale</b> <i>[src_min src_max [dst_min dst_max]]</i>:</dt><dd> Rescale the
input pixels values from the range <i>src_min</i> to <i>src_max</i> to
the range <i>dst_min</i> to <i>dst_max</i>.  If omitted the output range is
0 to 255.  If omitted the input range is automatically computed from the
source data.</dd>
<dt> <b>-srcwin</b> <i>xoff yoff xsize ysize</i>:</dt><dd> Selects a subwindow from
the source image for copying.</dd>
<dt> <b>-a_srs</b> <i>srs_def</i>:</dt><dd> 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. </dd>
<dt> <b>-projwin</b> <i>ulx uly lrx lry</i>:</dt><dd> Selects a subwindow from the
source image for copying (like -srcwin) but with the corners given in 
georeferenced coordinates. </dd>
<dt> <b>-mo</b> <i>"KEY=VALUE"</i>:</dt><dd> passes a metadata key and value to set
on the output dataset if possible.</dd>
<dt> <b>-co</b> <i>"NAME=VALUE"</i>:</dt><dd> passes a creation option to the output
format driver.  Multiple <b>-co</b> options may be listed.  See format 
specific documentation for legal creation options for each format.</dd>
<dt> <b>-mo</b> <i>"META-TAG=VALUE"</i>:</dt><dd> Add the indicated metadata values
to the output dataset.</dd>
<dt> <b>-quiet</b>:</dt><dd> Supress progress monitor and other non-error
output.</dd>
<dt> <i>src_dataset</i>:</dt><dd> The source file name.</dd>
<dt> <i>dst_dataset</i>:</dt><dd> The destination file name.</dd>
</dl>

\if man
\section example EXAMPLE
\endif

\htmlonly
Example:
\endhtmlonly

\verbatim
% gdal_translate -of GTiff -co "TILED=YES" utm.tif utm_tiled.tif
\endverbatim


\if man
\section author AUTHOR
Frank Warmerdam <warmerdam@pobox.com>

builds or rebuilds overview images
\section synopsis SYNOPSIS
\endif

\htmlonly
<h2><a name="gdaladdo">gdaladdo</a></h2>
Usage: 
\endhtmlonly

\verbatim
gdaladdo [-r {nearest,average,average_mp,average_magphase,mode}]
                filename levels
\endverbatim

\if man
\section description DESCRIPTION
\endif

The gdaladdo utility can be used to build or rebuild overview images for
most supported file formats with one over several downsampling algorithms. 

<dl>
<dt> <b>-r</b>
<i>{nearest,average,average_mp,average_magphase,mode}</i>:</dt><dd>
Select a resampling algorithm.</dd>
<dt> <i>filename</i>:</dt><dd> The file to build overviews for. </dd>
<dt> <i>levels</i>:</dt><dd> A list of integral overview levels to build.  </dd>
</dl>

<i>Mode</i> is not actually implemented, and <i>average_mp</i> is unsuitable 
for use.  <i>Average_magphase</i> averages complex data in mag/phase space.  
<i>Nearest</i> and <i>average</i> are applicable to normal image data.  
<i>Nearest</i> applies a nearest neighbour (simple sampling) resampler, while
<i>average</i> computes the average of all non-NODATA contributing pixels.

Selecting a level value like <i>2</i> 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.<p>

\if man
\section example EXAMPLE
\endif

\htmlonly
Example:
\endhtmlonly

 % gdaladdo -r average abc.tif 2 4 8 16

\if man
\section author AUTHOR
Frank Warmerdam <warmerdam@pobox.com>

simple image reprojection and warping utility
\section synopsis SYNOPSIS
\endif

\htmlonly
<h2><a name="gdalwarp">gdalwarp</a></h2>
Usage: 
\endhtmlonly

\verbatim
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]
	[-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]
    [-rn] [-rb] [-rc] [-rcs] [-srcnodata value [value...]]
    [-wm memory_in_mb] [-multi] [-q]
    [-of format] [-co "NAME=VALUE"]* srcfile dstfile
\endverbatim

\if man
\section description DESCRIPTION
\endif

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

<p>
<dl>
<dt> <b>-s_srs</b> <em>srs def</em>:</dt><dd> 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.</dd>
<dt> <b>-t_srs</b> <em>srs_def</em>:</dt><dd> 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.</dd>
<dt> <b>-order</b> <em>n</em>:</dt><dd> order of polynom used for warping
(1 to 3) </dd>
<dt> <b>-et</b> <em>err_threshold</em>:</dt><dd> error threshold for transformation approximation (in pixel units - defaults to 0.125).</dd>
<dt> <b>-te</b> <em>xmin ymin xmax ymax</em>:</dt></dd> set georeferenced extents of output file to be created.</dd>
<dt> <b>-tr</b> <em>xres yres</em>:</dt><dd> set output file resolution (in target georeferenced units)</dd>
<dt> <b>-ts</b> <em>width height</em>:</dt><dd> set output file size in
pixels and lines</dd>
<dt> <b>-wo</b> <em>"NAME=VALUE"</em>:</dt><dd> Set a lost of warp options. There is a
 <a href="warptut.html#warpoptions">list</a> of available ones. Multiple
 <b>-wo</b> options may be listed.</dd>
<dt> <b>-ot</b> <em>type</em>:</dt><dd> For the output bands to be of the indicated
 data type.</dd>
<dt> <b>-wt</b> <em>type</em>:</dt><dd> Working pixel data type. The datatype of
 pixels in the source image and destination image buffers.</dd>
<dt> <b>-rn</b>:</dt><dd> Use nearest neighbour resampling (fastest algorithm, worst
 interpolation quality).</dd>
<dt> <b>-rb</b>:</dt><dd> Use bilinear resampling.</dd>
<dt> <b>-rc</b>:</dt><dd> Use cubic resampling.</dd>
<dt> <b>-rcs</b>:</dt><dd> Use cubic spline resampling (slowest
algorithm).</dd>
<dt> <b>-srcnodata</b> <em>value [value...]</em>:</dt><dd> Set nodata masking values
 (several values may be specified). Masked values will not be used in
 interpolation.</dd>
<dt> <b>-wm</b> <em>memory_in_mb</em>:</dt><dd> Set the amount of memory (in bytes)
 that the warp API is allowed to use for caching.</dd>
<dt> <b>-multi</b>:</dt><dd> Use multithreaded warping implementation.
 Multiple threads will be used to process chunks of image and perform
 input/output operation simultaneously.</dd>
<dt> <b>-q</b>:</dt><dd> Be quiet.</dd>
<dt> <b>-of</b> <em>format</em>:</dt><dd> Select the output format. The default is GeoTIFF (GTiff). Use the short format name. </dd>
<dt> <b>-co</b> <em>"NAME=VALUE"</em>:</dt><dd> passes a creation
 option to the output format driver. Multiple <b>-co</b> options may be
 listed. See format specific documentation for legal creation options
 for each format. </dd>
<dt> <em>srcfile</em>:</dt><dd> The source file name. </dd>
<dt> <em>dstfile</em>:</dt><dd> The destination file name. </dd>
</dl>

Mosaicing into an existing output file is supported if the output file 
already exists. 

<p>
\if man
\section example EXAMPLE
\endif

\htmlonly
Example:
\endhtmlonly

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:<p>

\verbatim
% gdalwarp -t_srs '+proj=utm +zone=11 +datum=WGS84' raw_spot.tif utm11.tif
\endverbatim

For instance, the second channel of an ASTER image stored in HDF with
control points mapping the corners to lat/long could be warped to a UTM
projection with a command like this:<p>

\verbatim
% gdalwarp HDF4_SDS:ASTER_L1B:"pg-PR1B0000-2002031402_100_001":2 pg-PR1B0000-2002031402_100_001_2.tif
\endverbatim

\if man
\section author AUTHOR
Frank Warmerdam <warmerdam@pobox.com>

builds a shapefile as a raster tileindex
\section synopsis SYNOPSIS
\endif

\htmlonly
<h2><a name="gdaltindex">gdaltindex</a></h2>
Usage: 
\endhtmlonly

\verbatim
gdaltindex [-tileindex field_name] index_file [gdal_file]*
\endverbatim


\if man
\section description DESCRIPTION
\endif

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. 

<ul>
<li> The shapefile (index_file) will be created if it doesn't already exist.
<li> The default tile index field is 'location'.
<li> Raster filenames will be put in the file exactly as they are specified
on the commandline.
<li> Simple rectangular polygons are generated in the same
coordinate system as the rasters.
</ul>

\if man
\section example EXAMPLE
\endif

\htmlonly
Example:
\endhtmlonly

  % gdaltindex doq_index.shp doq/*.tif

\if man
\section author AUTHOR
Frank Warmerdam <warmerdam@pobox.com>

converts an image into a pseudo-colored image
\section synopsis SYNOPSIS
\endif

\htmlonly
<h2><a name="rgb2pct">rgb2pct.py</a></h2>
Usage: 
\endhtmlonly

\verbatim
rgb2pct.py [-n colors] [-of format] source_file dest_file
\endverbatim

\if man
\section description DESCRIPTION
\endif

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. 

<dl>
<dt> <b>-n</b> <i>colors</i>:</dt><dd> Select the number of colors in the generated
color table.  Defaults to 256.  Must be between 2 and 256. </dd>
<dt> <b>-of</b> <i>format</i>:</dt><dd> Format to generated (defaults to GeoTIFF).  Same
semantics as the <b>-of</b> flag for gdal_translate.  Only output formats
supporting pseudocolor tables should be used. </dd>
<dt> <i>source_file</i>:</dt><dd> The input RGB file. </dd>
<dt> <i>dest_file</i>:</dt><dd> The output pseudo-colored file that will be
created.</dd>
</dl>

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.

\if man
\section author AUTHOR
Frank Warmerdam <warmerdam@pobox.com>

 mosaics a set of images
\section synopsis SYNOPSIS
\endif

\htmlonly
<h2><a name="gdal_merge">gdal_merge.py</a></h2>
Usage:
\endhtmlonly

\verbatim
gdal_merge.py [-o out_filename] [-f out_format] [-v]
                     [-ps pixelsize_x pixelsize_y]
                     [-ul_lr ulx uly lrx lry] input_files
\endverbatim
\if man
\section description DESCRIPTION
\endif

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.


<dl>
<dt> <b>-o</b> <i>out_filename</i>:</dt><dd> The name of the output file to be
created.</dd>
<dt> <b>-f</b> <i>out_format</i>:</dt><dd> Output format, defaults to
GeoTIFF. </dd>
<dt> <b>-ps</b> <i>pixelsize_x pixelsize_y</i>:</dt><dd> Pixel size to be used for the
output file.  If not specified the resolution of the first input file will
be used.</dd>
<dt> <b>-ul_lr</b> <i>ulx uly lrx lry</i>:</dt><dd> The extents of the output file. 
If not specified the aggregate extents of all input files will be
used.</dd>
<dt> <b>-v</b>:</dt><dd> Generate verbose output of mosaicing operations as they are
done.</dd>
</dl>

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.

\if man
\section author AUTHOR
Frank Warmerdam <warmerdam@pobox.com>

determines various information about a GDAL installation
\section synopsis SYNOPSIS
\endif

\htmlonly
<h2><a name="gdal-config">gdal-config</a></h2>
Usage:
\endhtmlonly

\verbatim
gdal-config [OPTIONS]
Options:
        [--prefix[=DIR]]
        [--libs]
        [--cflags]
        [--version]
        [--ogr-enabled]
        [--formats]
\endverbatim

\if man
\section description DESCRIPTION
\endif

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. 

<dl>
<dt> <b>--prefix</b>:</dt><dd> the top level directory for the GDAL
installation.</dd>
<dt> <b>--libs</b>:</dt><dd> The libraries and link directives required to
use GDAL.</dd>
<dt> <b>--cflags</b>:</dt><dd> The include and macro definition required to compiled
modules using GDAL.</dd>
<dt> <b>--version</b>:</dt><dd> Reports the GDAL version.</dd>
<dt> <b>--ogr-enabled</b>:</dt><dd> Reports "yes" or "no" to standard output depending
on whether OGR is built into GDAL.</dd>
<dt> <b>--formats</b>:</dt><dd> Reports which formats are configured into GDAL to
stdout.</dd>
</dl>

*/



