For my project I need to get a raster containing green leaf index (GLI) values of a whole region.

My first idea was to merge all raster tiles and then extract the data. Upon attempting this though, the process takes a couple hours whereafter the process crashes due to insufficient memory (since I have to use very high resolution rasters). So merging all tiles into a greater mosaic and thereafter extracting the GLI values using a raster calculator is not an option.

I am able to simply load all data tiles into QGIS and perform the calculations across the 2000 individual raster tiles, but I do not know how to extract the data based on a shapefile/greater raster (<- for context, I am performing MaxEnt species distribution modelling on the data later so need to have the GLI values as an .asc format)

How can I extract the GLI data into a polygon/raster format without having to merge all individual tiles?

  • Sorry, question is unclear. You say you are "able to load the files onto QGIS and do the calculations" - so what exactly is the problem? And what do you mean by "extract the values into the polygon": which values, which polygon? Please edit your question to add more information. Sometimes, a screenshot helps to understand what you're trying to do.
    – Babel
    Commented Sep 25, 2022 at 10:15
  • Sorry let me try to edit it now and explain more clearly
    – Jessica
    Commented Sep 25, 2022 at 10:17
  • Hopefully it is a bit more clear now, any help would be appreciated
    – Jessica
    Commented Sep 25, 2022 at 10:22
  • Still not clear: you have a raster and each pixel/cell contains a value (GLI). You have a polygon (vector) covering a whole region with thousends or millions of pixels - which of these many pixels should be connected to the polygon? The very concept of vector layers does not make any sense to me here. On the other hand, you write you want to extract "into a polygon/raster format". So what exactly is your task?
    – Babel
    Commented Sep 25, 2022 at 10:29
  • Did I understand you correct: you have a raster layer with GLI values, but the raster has not just one, but more bands and you simply want to get a new raster with just the band that contains GLI? Or you want to clip the initial raster to the shape of a polygon layer? Or something else...?
    – Babel
    Commented Sep 25, 2022 at 10:30

1 Answer 1


To extract the band containing GLI values from a raster, use Menu Raster > Raster calculator with this expression: "raster@3" where raster is the name of the raster layer and 3 is the number of the band containing GLI.

To run the same algorithm for different raster layers one after the other, run Raster Calculator in batch mode: Menu Processing > Toolbox > Raster Calculator.

An option would be creating a virtual raster - Menu Raster > Miscellaneous > Build Virtual Raster and run the tool in "regular" mode (single process).

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.