[Gdal-dev] Problem with gdal_translate with the parameter -a_ullr 0
0 x x
Jean-Claude Repetto
jean-claude.repetto at worldonline.fr
Tue Oct 23 08:50:06 EDT 2007
Hi,
I have downloaded the high resolution Blue Marble images from the page
<http://visibleearth.nasa.gov/view_detail.php?id=2433> .
Both file contains 21600 x 21600 pixels.
Now, I want to transform them into a mosaic of 32 tiles in ECW format,
each of them containing 5400 x 5400 pixels.
So I have written this small script :
#!/bin/sh
i=0
while [ "$i" -lt 4 ]
do
j=0
while [ "$j" -lt 4 ]
do
gdal_translate -of ECW -co "TARGET=88%" -co
"DATUM=WGS84" -co "PROJ=GEODETIC" -co "LARGE_OK=YES" -a_ullr
$((-180+45*$i)) $((90-45*$j)) $((-135+45*$i)) $((45-45*$j)) -srcwin
$((5400*$i)) $((5400*$j)) 5400 5400 land_shallow_topo_west.tif
$((i))$((j)).ecw
gdal_translate -of ECW -co "TARGET=88%" -co
"DATUM=WGS84" -co "PROJ=GEODETIC" -co "LARGE_OK=YES" -a_ullr $((45*$i))
$((90-45*$j)) $((45*($i+1))) $((45-45*$j)) -srcwin $((5400*$i))
$((5400*$j)) 5400 5400 land_shallow_topo_east.tif $((i+4))$((j)).ecw
j=$(($j+1))
done
i=$(($i+1))
done
exit 0
The conversion is OK for all the tiles except one. This tile has
something special, the coordinates of the UL-LR corner are both zero :
gdal_translate -of ECW -co TARGET=88% -co DATUM=WGS84 -co PROJ=GEODETIC
-co LARGE_OK=YES -a_ullr 0 0 45 -45 -srcwin 0 10800 5400 5400
land_shallow_topo_east.tif 42.ecw
This is the result of gdal_info (You can see that the corner coordinates
are wrong) :
$ gdalinfo 42.ecw
Driver: ECW/ERMapper Compressed Wavelets
Size is 5400, 5400
Coordinate System is:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9108"]],
AXIS["Lat",NORTH],
AXIS["Long",EAST],
AUTHORITY["EPSG","4326"]]
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 5400.0)
Upper Right ( 5400.0, 0.0)
Lower Right ( 5400.0, 5400.0)
Center ( 2700.0, 2700.0)
Band 1 Block=5400x1 Type=Byte, ColorInterp=Red
Overviews: arbitrary
Band 2 Block=5400x1 Type=Byte, ColorInterp=Green
Overviews: arbitrary
Band 3 Block=5400x1 Type=Byte, ColorInterp=Blue
Overviews: arbitrary
Other tiles are OK. For example :
$ gdalinfo 02.ecw
Driver: ECW/ERMapper Compressed Wavelets
Size is 5400, 5400
Coordinate System is:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9108"]],
AXIS["Lat",NORTH],
AXIS["Long",EAST],
AUTHORITY["EPSG","4326"]]
Origin = (-180.000000000000000,0.000000000000000)
Pixel Size = (0.008333333333333,-0.008333333333333)
Corner Coordinates:
Upper Left (-180.0000000, 0.0000000) (180d 0'0.00"W, 0d 0'0.01"N)
Lower Left (-180.0000000, -45.0000000) (180d 0'0.00"W, 45d 0'0.00"S)
Upper Right (-135.0000000, 0.0000000) (135d 0'0.00"W, 0d 0'0.01"N)
Lower Right (-135.0000000, -45.0000000) (135d 0'0.00"W, 45d 0'0.00"S)
Center (-157.5000000, -22.5000000) (157d30'0.00"W, 22d30'0.00"S)
Band 1 Block=5400x1 Type=Byte, ColorInterp=Red
Overviews: arbitrary
Band 2 Block=5400x1 Type=Byte, ColorInterp=Green
Overviews: arbitrary
Band 3 Block=5400x1 Type=Byte, ColorInterp=Blue
Overviews: arbitrary
I have looked into Trac and could not find such a bug. Is it a know bug,
or should I report it ?
Thanks,
Jean-Claude
More information about the Gdal-dev
mailing list