4

I am hoping to find a relatively straightforward way to create a virtual raster for a large set of rasters (c. 15,000 TIF files from the TQ 100K Square of OS 1-10K).

I cannot do this in QGIS. I get the following error: "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program". Presumably this is because there are too many files: it works fine for other squares with fewer files.

I have attempted copying and pasting the script that QGIS generates into OSGeo4W Shell, and running it there without success. I have run this at the root of the drive (H:>), the destination folder for the virtual raster, and the folder containing the source tifs. Clearly I am doing something wrong, but I do not have the expertise to know what, or how to remedy it.

The script I get is: gdalbuildvrt "//..../My Documents/GIS/Datasets/Ordnance Survey/1-10,000/2018/Virtual Rasters/1-10K_TQ.vrt" "...list of files..."

Is it possible to do this through OSGeo4W Shell, or do I just need to break it down into smaller chunks and run it through QGIS?

I have tried numerous pieces of advice on here and elsewhere, e.g. https://astuntech.atlassian.net/wiki/spaces/ISHAREHELP/pages/14844053/Mosaic+thousands+of+raster+images, but they are either not specific enough to my situation, or require a level of understanding of script which I do not have.

  • 1
    that wiki page assumes you are on a unix box – Ian Turton Mar 2 '18 at 17:09
3

You need to generate a file containing a list of the tiffs one per line:

dir /b /s H:\My Documents\GIS\Datasets\Ordnance Survey\1-10,000\2018\TQ\*.tif > files.txt

Here you are using the standard windows dir command to list all the .tif files into a file called files.txt. (/b removes the header/footer, and /s makes it recursive). This allows you to avoid the command line length limit by passing that file to gdalbuildvrt using the -input_files_list option:

gdalbuildvrt -input_file_list files.txt 1-10K_TQ.vrt

Since you used a full path in the file names list you can use it anywhere and just create the vrt where you need it.

  • Sorry Ian, you're going to have to unpack that for me a bit more please: the tiffs are contained in the folder: H:\My Documents\GIS\Datasets\Ordnance Survey\1-10,000\2018\TQ - I've tried inserting that into the 1st piece of script you have written there, with no joy, but then I am probably doing this wrong. Please could you clarify what I should be entering here? – JimS-W Mar 2 '18 at 17:21
  • Still not working I'm afraid: keeps saying "The system cannot find the path specified". Should I literally be pasting: dir /b /s H:\My Documents\GIS\Datasets\Ordnance Survey\1-10,000\2018\TQ*.tif > files.txt into H:\> ? – JimS-W Mar 2 '18 at 17:42
  • 1
    alternatively test it out in smaller steps: dir My Documents then dir My Documents\GIS etc to see where the path is wrong – Ian Turton Mar 2 '18 at 17:43
  • 2
    If it's still complaining about not finding the path, maybe try "H:\Users\yourusernamehere\Documents". The spaces in the pathname could be another culprit, you could try double-quoting the whole pathname part too like: "H:\My Documents\GIS\Datasets\Ordnance Survey\1-10,000\2018\TQ*.tif" – cm1 Mar 2 '18 at 19:32
  • 1
    can you get dir to list the files at all? – Ian Turton Mar 5 '18 at 13:16

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.