1

I have a dataset of over 400 .tif-files, which I'm supposed to merge in QGIS into a single layer, representing a base map. These .tif files are pieces of a topography map (scale of 1 to 50000), and the file sizes are between 2 MB and 83 MB.

I'm relatively new to QGIS, and I have no idea what would be the smartest way to handle this (if there is any). Is it possible to create anything similar to ArcMap mosaic datasets in QGIS? I was specifically requested to find a way to do this in QGIS.

My research on the topic suggested that I could try to 1. build pyramids and then build a virtual raster or 2. use the merge function. Well, building pyramids for 400+ files seems painfully slow and manual.

Building a virtual raster without pyramids only gave me the error: "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program". I have a write permission to the disk with the input and output locations, so that shouldn't be the problem.

Merge-function apparently only works for a few rasters at a time, not 400 of them.

Any ideas?

  • 2
    "Building a virtual raster without pyramids only gave me an error." we need to know what error you got. – Ian Turton Jun 20 '18 at 10:51
  • The error: "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program". I have a write permission to the disk with the input and output locations, so that shouldn't be the problem. – user122728 Jun 20 '18 at 11:31
  • sounds like you have some missing programs, I assume you are on windows? did you use osgeo4w to install, if so check you added the python modules – Ian Turton Jun 20 '18 at 12:05
  • 2
    Please avoid statements like "file size is pretty huge" - get the file properties and tell us how many megabytes, or the typical resolution in pixels of height x width. – Spacedman Jun 20 '18 at 12:10
  • Please Edit the question in response to requests for clarification. It's not fair to those who would answer to need to mine the comments for critical information. 400 is not a large number of rasters to mosaic. I suggest you organize them into strips along the X axis, merge those, then merge along the Y. – Vince Jun 20 '18 at 13:12
1

Solved it.

I think the source of the error I got building a virtual raster was some sort of character limit in the Build Virtual Raster tool. After adding the input files (400+ of them) some of the text in the box at the bottom of the Build Virtual Raster tool window was cut off. Other people have also had this issue.

I avoided this by using gdalbuildvrt through OSGeo4W Shell.

Here's what I did:

  1. Used Translate tool to convert paletted .tifs into RGBs
  2. Created a virtual raster from the RGBs (also added a forced CRS):

    gdalbuildvrt basemap.vrt *.tif -a_srs "EPSG:3395"
    
  3. Built overviews for the virtual raster (similar fashion as user30184 suggested):

    gdaladdo -ro --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config INTERLEAVE_OVERVIEW PIXEL --config BIGTIFF_OVERVIEW YES basemap.vrt 2 4 8 16 32 64
    
  4. Additional step: Created a footprint/grid of all the .tifs, to get a look similar to ArcMap mosaic datasets (found this here):

    gdaltindex footprint.shp *.tif
    

Also found this site helpful since I've no previous scripting experience.

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.