[Gdal-dev] gdalwarp

Frank Warmerdam warmerdam at pobox.com
Fri Dec 13 17:12:53 EST 2002


Folks,

As a spinoff of a contract with i-cubed I have implemented a simple image
reprojection and warping utility called "gdalwarp".  It currently has
the following limitations:

  o Only 8 bit data is can be warped.
  o The entire source image is held in memory.
  o Only nearest neighbour resampling is available.

However, the warping functions are reasonable well done.  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.   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

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.

The polynomial models generated from GCPs are currently only up to 3rd
order, and are not terrible stable at 3rd order.  Andrey and I are working
on that.  Second order is nice and safe.  You can set the extents and
resolution of the output file, use an existing output file (mosaic into it)
or let gdalwarp create an output file with approximately the correct region
and similar resolution to the source image.

The usage message looks like this:

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

I will try to ensure gdalwarp makes it into future OpenEV_FW binary releases.

However, I am not spending too much time documenting gdalwarp as it stands,
and I may have another contract soon to extend the resampling engine to
support:
  o caching of input ... support input images much larger than can be held
    in memory.
  o several resampling kernels.
  o support all data types.

The transformation functions (using GCPs, reprojection, affine geotransforms
and approximated transforms) are found in gdal/alg, and I intend this to be
the "standard" model for coordinate transformations in GDAL.  Even the
improved image warping work would continue to build on these.  Anyone doing
"geometric" work with GDAL might want to review them.

Finally, I would like to thank i-cubed (www.i3.com) for supporting this work.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list