[Gdal-dev] gdalwarp

Frank Warmerdam warmerdam at pobox.com
Thu Nov 15 00:46:16 EST 2007


Meek, Allan (Contractor) wrote:
> Would it be possible to do step the following with the gdalwarp API?
> 
> 1. Open an image.
> 2. Check if the image meets certain criteria.
> 3. Reproject the image using gdalwarp without creating a new file or
> modifying the original file.
> 
> 1 and 2 are simple enough, but it's 3 that's got me stumped. The
> examples of gdalwarp that I've been able to find create a new file with
> the reprojected image.

Allan,

You could essentially warp the file to a memory image without writing to disk,
or create a "warped vrt" dataset that is essentially a virtual dataset which
will warp the original dataset into the target coordinate system on the fly.

The "warped vrt" approach can be approximated by doing:

   gdalwarp -of VRT utm.tif -t_srs WGS84 wgs84.vrt

Basically, if you could construct a similar VRT in memory then you would
have such a virtual dataset.  In fact, I think there is a convenient function
for doing this, if it is what you want, called GDALInitializeWarpedVRT().
See gdal/apps/gdalwarp.cpp for an example of it's use.

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    | President OSGeo, http://osgeo.org




More information about the gdal-dev mailing list