[Gdal-dev] Geotransform (Rotate Image 270 degrees)

Frank Warmerdam warmerdam at pobox.com
Wed Apr 23 08:54:53 EDT 2008


simonm1234 wrote:
> Hi,
> 
> How do you rotate an image 270 degrees using SetGeoTransform? 
> 
> What values should I use for  adfGeoTransform[2] and adfGeoTransform[4]?
> 
> Thanks,
> Simon.
> 
> // Set Bounds/Pixel size: {}
> //adfGeoTransform[0] /* top left x */
> //adfGeoTransform[1] /* w-e pixel resolution */
> //adfGeoTransform[2] /* rotation, 0 if image is "north up" */
> //adfGeoTransform[3] /* top left y */
> //adfGeoTransform[4] /* rotation, 0 if image is "north up" */
> //adfGeoTransform[5] /* n-s pixel resolution */
> 
> double[] trans = new double[] {325000.0, 10, 0.0, 1010000.0, 0.0, -10}
> ds.SetGeoTransform(trans);

Simon,

First, lets be clear, SetGeoTransform() does not rotate anything.  It
just records a transformation between pixel/line and georef space.  You
can set a geotransform that describes an image that is "west-up" as
opposed to the normal "north-up".

An image with the first (top left pixel not accounting for georeferencing)
actually appearing at the bottom left (west up) might look like:

  { 325000, 0, -10.0, 1010000, 10.0, 0.0 }

This basically means that each step along a scanline is a step 10m north,
and each step down an image column is a 10m step east.

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