Skip to main content Link Search Menu Expand Document (external link)

Useful GDAL commands

Mosaic raster files

To mosaic a list of DEM files, all the tiles should be in the same folder. Only the tiles that need to be mosaicked should be in the folder.

gdalwarp PATH_TO_FOLDER/* MY_DEM_MOSAIC.tif

Reproject and convert to .bil format

LSDTopotools requires DEM in bil format, projected in the UTM coordinate system. The easiest way to properly format files is using the following procedure.

# Project DEM into UTM projection
gdalwarp -t_srs '+proj=utm +zone=31 +datum=WGS84' -of ENVI -dstnodata -9999 -tr 10 10 -r bilinear input_filename.tif output_filename.bil

# Convert the DEM into a ENVI BIL format
gdal_translate -of ENVI dem-input.tif dem-output.bil

More info here.

Zip / Unzip folders

To zip folders:

zip -r MY_ZIPPED_FILE.zip MY_FOLDER_TO_ZIP

To unzip folders:

unzip MY_ZIPPED_FILE.zip