[GIS] Merging .asc files = “The command line is too long”

lidarmergeqgis

Having problems merging LiDAR .asc folder files to produce a single GeoTiff file.

I have followed various instructions e.g. the 2 methods of selecting input files for merging .asc files using

  1. folder -> select all and
  2. Choose input directory instead of files check box

Output folder & file created

When I click OK get – " the command line is too long " dialogue box error. Both input methods result in getting the same error message.

Any thoughts?

enter image description here

Best Answer

This is a pretty long standing problem with the gdal_merge tool accessed through the user interface.

The easiest way to get around it is to first build a virtual raster (VRT) file and then (if necessary) convert this to a geotiff. If you have lots of files it is more stable and faster to use the OSGeo4W shell to build the VRT rather than using the tool through the QGIS interface.

The help page for the VRT is here: http://www.gdal.org/gdalbuildvrt.html

This example from that page is probably what you're looking for:

Example: Make a virtual mosaic from all TIFF files contained in a directory :

gdalbuildvrt doq_index.vrt doq/*.tif

Once you have the VRT you can convert it into a geotiff by "saving as" from the QGIS interface; if you need to that is.

Related Question