[GIS] Obtain GeoTIFF with ASCII files

batchesri-ascii-rastergeotiff-tiffqgis

I´m trying to obtain GeoTIFF files to use them in Photoscan from ASCII files.

My process is as follows: I have 200 ASCII files more of less, I use the ASCII to raster tool in batch mode process in Arc GIS and with this I obtain an ESRI Raster, then I want to use the convert tool of QGIS to obtain the GeoTIFF.

My specific problem is I can´t save the files in other directory instead the default directory in the batch mode and that means that I can´t have the files in the right format to use it in QGIS because they are inside a geodatabase.

Probably exist other way to do what I´m trying to do but I don´t know it.

I share a sample ASCII file.
enter link description here

Best Answer

You can do direct from ASCII to GeoTIFF with gdal_translate.

At its most basic you can do:gdal_translate -of GTiff input.asc output.tif

Or you can do write the output to a different folder: gdal_translate -of GTiff indir/input.asc outdir/output.tif

To batch process them in bash (on Linux) I'd do something like:

#!/bin/bash
# Create geotiffs
for f in $(ls *.asc)
  do
    echo Processing $f
    gdal_translate -of GTiff $f outdir/$f
  done
exit 0

In a Windows batch file I'd do something like:

for /f %%f in ('dir /b *.asc') do gdal_translate -of GTiff %%f outdir/%~n1.tif

or straight at the command line without the double %:

for /f %f in ('dir /b *.asc') do gdal_translate -of GTiff %f outdir/%~n1.tif