I have a directory of OS data stored as tiff files (approximately 2000), which I want to create a virtual raster with. I understand that you can run this in the QGIS UI but because of the large number of files it is not possible (see: QGIS virtual raster – insufficient permissions)
I therefore want to run this in the command line of which I have very little experience. My workflow so far is this:
-
I have changed the directory to the "data" folder where all of the raster tiles are saved.
-
I then use the following code to try and build a VRT with all the tiff files that are within that directory with a CRS of BNG 22770.
gdalbuildvrt Vector_district.vrt data/*tif
Can someone please help me with this bearing in mind I have little to no experience in coding or the command line?
Best Answer
The problem is that this construction is trying to look for a "data" folder within your existent "...\Vector Map District Raster\data" folder. Since there is no such "...\data\data" folder, it returns an error.
You'd need to iterate through each folder, but as far as I know there is no way to do this with gdalbuildvrt (or any other GDAL utility, for that matter). You have three options here, as I see it:
1) Put all your TIFFs in a single folder. This way, you can call the utility as:
2) Create a list of file paths for each raster, and put it in a text file (one filepath per line), as such:
and so forth. Save this list as a txt, and call it in the utility:
3) Do it in python. For this you'll need the GDAL python bindings, which you can get from here. Then you do: