[Gdal-dev] Copying over ProjectionRef as Subset

Frank Warmerdam warmerdam at pobox.com
Wed Jan 24 14:12:22 EST 2007


Matt Hanson wrote:
> Hi,   I've read through the Warp API tutorial and am having trouble on how
> to it apply it to my problem.
> 
> I'm taking a subset of an image, and writing it to a VRT file, before it
> gets processed by some future algorithm.    I'm copying the rest of the
> metadata, but need to now change the ProjectionRef string to match the new
> coordinates.
> 
> Is this something that is going to be driver dependent?

Matt,

I don't see this as being driver dependent.

To recap you are wanting to produce a "warped vrt" that represents
a reprojected view of a subarea of an original image.  Is that right?

This can be accomplished with gdalwarp using a command like:

   gdalwarp -of VRT in.tif out.vrt -t_srs WGS84 -te -117 33 -116 34

If you are trying to manually create the .vrt then looking at the output
of a command like the above should be educational.  If you want to see how
to create the VRT programmatically then looking at the gdalwarp code
should be useful.

Note that the warp api tutorial doesn't touch on some specific issues
with producing warped vrts.

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