[Gdal-dev] Converting .bmp to GeoTIFF
Frank Warmerdam
warmerdam at pobox.com
Thu Jan 16 20:22:28 EST 2003
Don Tidrow wrote:
> Can any of the gdal utilities be used to add georeferencing data
> (corners in UTM) to a .bmp file and output the result to a GeoTIFF file?
> If so, how? Eventually I'll want to reproject the resulting GeoTIFF to
> lat/long, which I think gdalwarp can do, but I haven't figured out if
> gdal_translate can do this conversion.
Don,
The -a_srs option in gdal_translate can be used to assign a coordinate
system to a file as it is copied. However, setting the corner coordinates
is not so simple. One approach would be to write an ESRI style world file
for the .bmp. World files generally look like this:
60.0000000000
0.0000000000
0.0000000000
-60.0000000000
440750.0000000000
3751290.0000000000
The values are <x pixelsize>, 0, 0, <negative y pixel size>, <topleft X>,
<top left y>.
So, given a bmp file called abc.bmp you would write an abc.wld file with
the top left corner and pixel size, and then you could use a command like
this to turn it into a UTM GeoTIFF file:
gdal_translate abc.bmp abc.tif -a_srs '+proj=utm +zone=11 +datum=WGS84'
The gdalwarp program also has something similar to the -a_srs flag but
it is -s_srs. So to warp directly to lat/long you would still write the
.wld file, and use a gdalwarp command like:
gdalwarp -s_srs '+proj=utm +zone=11 +datum=WGS84' \
-t_srs '+proj=latlong +datum=WGS84' abc.bmp abc.tif
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