I often need to convert a set of rasters from a format to another format.
To do this is very useful a really simple batch procedure using the features of dos shell scripting language.

Convert from a set of Geotiff rasters to a set of TIF+TFW rasters removing also the Geotiff tags

The source_folder is the folder where (include subfolders) there is the source TIF. The target_folder is the destination for raster outputs.
Also EPSG:3003 is the source SRS and also EPSG:3003 is the target SRS.

The option PROFILE=BASELINE remove the geotiff tags, the TFW=YES ask to create the TFW file.

for /R F:/folder1/source_folder %f IN (*.tif) do gdalwarp.exe -co PROFILE=BASELINE -co TFW=YES -s_srs EPSG:3003 -t_srs EPSG:3003 -r near -ot Byte -srcnodata "0" -of GTiff %f F:/folder1/target_folder/%~nf.tif

With the version 1.8.0 of GDAL is also possible to convert from a PDF with an image embedded (georef and not) into a Raster like Tiff. The next code will show how to translate a folder of pdf not geref in simples tiff (obviously not georeferenced)

for /R F:/folder1/source_folder %f IN (*.pdf) do gdal_translate.exe -co PROFILE=BASELINE -co TFW=NO -of GTiff %f F:/folder1/target_folder/%~nf.tif

Happy converting Andrea Peri.

Last modified 9 years ago Last modified on May 30, 2013, 6:04:42 AM
Note: See TracWiki for help on using the wiki.