[gdal-dev] gdal_translate upside down image

Frank Warmerdam warmerdam at pobox.com
Fri Jan 16 15:52:10 EST 2009


Greg Ederer wrote:
> Hi,
> 
> I'm running gdal_translate against a VRT file:
> 
> <VRTDataset rasterXSize="751" rasterYSize="801">
>   <GeoTransform>-20.05, 0.1, 0.0, 40.05, 0.0, -0.1</GeoTransform>
>   <SRS>
>         GEOGCS[&quot;WGS 84&quot;,
>             DATUM[&quot;WGS_1984&quot;,
>                     SPHEROID[&quot;WGS 84&quot;,6378137,298.2572235630016,
>                             AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],
>                     AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],
>             PRIMEM[&quot;Greenwich&quot;,0],
>             UNIT[&quot;degree&quot;,0.0174532925199433],
>             AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]
>   </SRS>
>   <VRTRasterBand dataType="Float32" band="1" subClass="VRTRawRasterBand">
>     <SourceFilename 
> relativetoVRT="1">10day_precip.bin.1999121</SourceFilename>
>     <ImageOffset>0</ImageOffset>
>     <PixelOffset>4</PixelOffset>
>     <LineOffset>3004</LineOffset>
>     <ByteOrder>MSB</ByteOrder>
>     <NoDataValue>-999.0</NoDataValue>
>   </VRTRasterBand>
> </VRTDataset>
> 
> I just noticed that the resulting GeoTIFF is upside down.  Is this a 
> problem with my GeoTransform values?  If so, what values would produce 
> the image right side up?

Greg,

I don't see any obvious problem with the geotransform values.

Perhaps the image really is upside on disk.  If so, you could flip it as
it is read by changing your values to

<ImageOffset>2403200</ImageOffset>
<PixelOffset>4</PixelOffset>
<LineOffset>-3004</LineOffset>

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