In a single folder I have a large set of aereal images (.tif), all georeferenced in EPSG:5677. They cover a "large" total area.

I need to load a small set of them, covering only a fraction of the total area in QGIS.

As the filenames are just unsorted numbers, I wonder wheather there is an option to select files by geographic location while they are not loaded in a project. I work in QGIS, a R-solution would also help.


One way to do this would be using pyqgis/python:

  1. Create QGIS action or python plugin or standalone script (the last might be harder for non programmers)
  2. It canvas get canvas extent and create in memory vector polygon (see Getting co-ordinates of current map canvas using PyQGIS? and How to export a vector layer to a new layer and take extent from canvas?)
  3. Loop through directory of rasters (use os.walk() method), to get raster layer object or adding layers to map canvas see, QGIS doc Loading Layers.
  4. For each raster get raster extent and convert extent into in memory polygon
  5. Intersect canvas polygon with raster polygon (using feature.geometry().intersects() mehtod), if they intersect add raster layer to canvas (see Pyqgis: "a.geometry().intersects(b.geometry())" wouldn't find any intersections but should. Why?)
  6. Continue looping through raster directory...

If you get stuck, post your code attempt to your question and I'm sure someone else can further help.

|improve this answer|||||

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