[Gdal-dev] img format resizing

Frank Warmerdam warmerdam at pobox.com
Fri Apr 2 14:50:35 EST 2004


list67 at netscape.net wrote:
> Frank,
> 
> Here are the gdalinfo reports for the before and after resizing img files:
> 
> gdalinfo ./beforeResize.img 
> Driver: HFA/Erdas Imagine Images (.img)
> Size is 1487, 2900
> Coordinate System is:
> LOCAL_CS["Unknown",
>     UNIT["meters",1]]
> Origin = (0.000000,0.000000)
> Pixel Size = (0.00010000,0.00010000)
> Corner Coordinates:
> Upper Left  (   0.0000000,   0.0000000) 
> Lower Left  (   0.0000000,   0.2900000) 
> Upper Right (   0.1487000,   0.0000000) 
> Lower Right (   0.1487000,   0.2900000) 
> Center      (   0.0743500,   0.1450000) 
> Band 1 Block=64x64 Type=Byte, ColorInterp=Undefined
> Band 2 Block=64x64 Type=Byte, ColorInterp=Undefined
> Band 3 Block=64x64 Type=Byte, ColorInterp=Undefined
> Band 4 Block=64x64 Type=Byte, ColorInterp=Undefined

Mike,

This coordinate system is indeed "upside down" to what GDAL expects.
One slightly clumsy approach to working around this is to create a
virtual file for your dataset and edit the geotransform in that.

eg.

gdal_translate -of VRT beforeResize.img beforeResize.vrt

... edit beforeResize.vrt changing the sign of the 5th # of the
     <GeoTransform> to be negative

gdalwarp beforeResize.vrt ...

Basically, gdalwarp is not setup to work with inputs in what it
considers upside coordinate systems.

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