Some days ago, I had problems resampling arc info ascii grid file via CLI. Why CLI and not a GIS like GRASS? Because, the engine of every GIS is the GDAL library. Using it via command line is very very fast…once learnt how to do!
Googling, I found the solution in a recent discussion in gis.stackexchange.com. Here I would like to summarize some important notions, because I need to write everything I want to remember, at least once.
Thus the command
gdalwarp is what I need.
- -of format: is the output format;
- -tr xres yres: set the output file resolution (in target georeferenced units, in my case degrees/pixel for EPSG 4326);
- -r resampling_method: set the resampling method to use. Available methods are:
nearest neighbour resampling (default, fastest algorithm, worst interpolation quality)
cubic spline resampling
Lanczos windowed sinc resampling
average resampling, computes the average of all non-NODATA contributing pixels
mode resampling, selects the value which appears most often of all the sampled points.
However, this command return this error:
because gdalwarp does not support AAIGrid format as direct output format.
So, the resampling has to be done with a different file format as output, e.g. the GDAL Virtual raster (.VRT):
done that, it’s possible to conver the DEM into new ASCII Grid file with gdal_translate