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

2 Answers 2


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.


If you make the file names very small such as a sequential number per file, then the merge tool has a greater chance of success. The software called "Total Commander" is excellent at simple file renaming operations in Windows.

  • Of course there'll be limits again in case of too many files. But for my current problem, this was a simple and quick fix. I placed the files also in a short path (e.g. "C:\T")
    – openwater
    Sep 16, 2018 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.