Wednesday, November 10, 2010

How to FWTools / GDAL for free and easy file conversion

GDAL is a translator library for raster geospatial data formats that is released under an X/MIT style Open Source license by the Open Source Geospatial Foundation. This tool can be accessed for free and easy file type translation between software through the FWTools package, downloadable at http://fwtools.maptools.org/. Its command line format so you can refer to the note below as a quick tutorial; this is specific to conversion between Tif and Idrisi raster, however in FWTools you can type ‘gdal_translate help’ to view a list of the file formats that you can work between.

To import GeoTiff to Idrisi using GDAL

You’ll need to be logged in as an administrator to both download and install, and then run this program.

1. Download and install FWTools from: http://fwtools.maptools.org/

The GDAL (command line utilities) is one of the tools included.

2. Open the “Start\All Programs\FWTools x.x.x\FWTools Shell”

3. In the DOS prompt type:
DOS SHELL SAYS –> C:Program Files/FWToolsx.x.x>
TYPE THIS –> gdal_translate -of rst -b 1 input.tif output.rst

‘-of’ means ‘output format’.

The part that says ‘-b’ means that there are multiple bands. For example, if there are
4 bands for this file so you’ll need to type into this DOS prompt 4 times. -b 1, -b 2, etc…

Where it says input.tif, type in the name of your tif file with .tif extension. Where it says output, type the name you’d like the output raster file to have with the .rst extension. Be sure to type in full path names otherwise the default will be for gdal to look in the ‘C:Program Files/FWTools Shell’ folder.

4. Check projection, data type, size, etc:

E:\Data\> gdalinfo output.rst

5. Reproject if necessary:

E:\Data\> gdalwarp -t_srs ‘EPSG:4296′ output.rst output2.rst

FWTools example

…a quick sidenote. FWTools runs in a DOS prompt wich initially begins in the FWTools directory; from here you can run the translation and enter full path and file names for your data, or use the typical change directories command (cd) to run the translation from the directory already containing your data, in which simple file names will work.


Enjoy ubuntu... ;)

Tq http://dgsg.wordpress.com

No comments:

kunkun-laptop .... ;)