[Gdal-dev] Converting DTED to image file format

Frank Warmerdam warmerdam at pobox.com
Sun Oct 29 11:27:21 EST 2006

paulp1_adsl at hotkey.net.au wrote:
> I'm new to GDAL and I have a directory of .dto files - obviously tiled 
> and I would like to know how I specify the command gdal_translate to 
> convert a whole directory of .dt0 files to one .png image file. Is this 
> possible to do?


There are two GDAL commands for merging many files.  The gdal_merge.py
Python script, and in GDAL 1.3.2 and later you can use gdalwarp.

You might try something like:

   gdalwarp abc/*.dt0 mosaic.tif

If you wish to output them as a PNG file then you need to do things in
a two step process since PNG is not a randomly writable format.  So the
second stage would be something like:

   gdal_translate -of PNG mosaic.tif mosaic.png

Are you wanting 16bit elevation PNGs for some special purpose, or just
an 8bit greyscale result for display in normal web browsers?  If you want
an 8bit result then you would need to rescale the pixel values.

   gdal_translate -of PNG -scale mosaic.tif mosaic.png

If you also need a world file with the png file (for geolocation in
some applications) use a command like:

   gdal_translate -of PNG -scale -co WORLDFILE=YES mosaic.tif mosaic.png

You might find it helpful to read up on the gdalwarp, and gdal_translate
program (under "GDAL Utility Programs" on the web page), and the PNG driver
(under "Supported Formats" on the web page).

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