I have 17.000 individual files that I would like to load into QGIS.

These files are .img-files (Rasters) that contain land elevation data. Each file is about 1 Mb in size. I tried to add in all the layers, but QGIS would not respond.

How can this data be imported to QGIS?

I'm using QGIS 3.4.10

  • 7
    Have you tried building a virtual raster? Raster - Miscellanous - Build virtual raster. Then you dont need to add them all to QGIS
    – BERA
    Mar 20, 2020 at 14:36
  • I tried to Build Virtual Raster, But I get an error saying "Incorrect Parameter Value For Input". I think it can't process the .img file type. Here's a screen shot of the error, i.imgur.com/SrSPbuj.png
    – Sir.Socks
    Mar 20, 2020 at 17:15
  • I confirm that .img is not supported. Are there any other suggestions?
    – Sir.Socks
    Mar 20, 2020 at 17:21

2 Answers 2


You can convert your .img files to .tif using gdal_translate. Here is a shell script to convert all .img in actual folder to .tif

#! /bin/bash
for i in *.img; do
    gdal_translate $i ${i%.*}.tif

After this you can build .vrt

gdalbuildvrt all.vrt *.tif

Depending on the size of your rasters, you had better to build pyramids for faster rendering:

for i in *.tif; do gdaladdo -ro -r cubic $i 2 4 8 16; done

The command will generate external overlays in .ovr files what QGIS can use. Finally you should add all.vrt to your QGIS project.

  • 2
    You can build the virtual raster directly from the .img files. Mar 20, 2020 at 19:52

Only a small addendum to the given answer:

It's always wise to translate raster data into compressed TIF format (GeoTiff Compression for Dummies - Paul Ramsey).

In your case, I don't know your data (*.img could be HFA-ERDAS Imagine files or ArcGIS DEM - USGS Land Cover? - files) but guess it's single band DEM raster data.

If I'm right, you should compress the resulting TIF with the lossless DEFLATE compression method.

Here is the command line call on Windows (OSGeo4W Shell), but shouldn't be so different in Linux:

for %i in (*.img) do 
gdal_translate --config GDAL_CACHEMAX 1024 -co NUM_THREADS=ALL_CPUS -co COMPRESS=DEFLATE -co ZLEVEL=9 -co PREDICTOR=2 -co TILED=YES %i %~ni.tif

Then you can create the virtual mosaic (*.VRT) as already suggested:

gdalbuildvrt mosaic.vrt *.tif

After you successfully built your mosaic, you have to decide what you will do next:

1) building a hillshade or relief using gdaldem (https://gdal.org/programs/gdaldem.html) and attaching some overviews to the resulting TIF:

gdaladdo --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config GDAL_TIFF_INTERNAL_MASK YES -r cubicspline hillshade.tif 2 4 8 16

2) Loading the *.VRT into QGIS and dynamically building hillshades via styling:

A small hint here: i'ts not possible to call the layer properties from such a big file inside QGIS, but you could load a small DEM file first, set your preferred styling, set the visibility scale and change the datasource to your *.vrt afterwards using the wonderful "changeDataSource" plugin (right click on your layer to open the changeDataSource dialog).

3) Loading the *.VRT following the hint in 2) and dynamically creating cross-sections: that's another story where you find the answer here: Profile Tool has too high resource consumption: Alternative or work around?

  • That's lots of really good information! Thanks alot @Christoph
    – Sir.Socks
    Mar 21, 2020 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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