4

I have one raster containing information of land cover classification (0 for other land covers, 1 for my specific land cover), the second raster contains info about the LAI and the Chlorophyll Content (CC).

What I want to do is to extract info from my second raster, so the LAI and CC values are assigned to my specific land cover in raster one.

Any idea how to do that in QGIS?

  • 'Cross Classification and Tabulation' and optionally 'r.cross' which creates a cross product of class values from multiple rasters may be used to derive the results. Both tools are available in QGIS. – Ben Nov 21 at 10:15
  • Could you please specify more in detail what you mean with "extract info from my second raster"? An example would be great to help you finding the best solution. – RafDouglas Nov 21 at 10:53
  • So, my first raster is the classification image contains 0=other land cover, 1= my specific land cover. My second raster is containing leaf area index. So I would like to overlay the values from the second raster to my classification image. Therefore, at the end I will get LAI of my specific land cover. – Lia Sartika Nov 21 at 10:57
  • OK, thanks, see my updated answer. – RafDouglas Nov 21 at 12:22
4

You can use the Raster Calculator tool:

enter image description here

It is quite a generic and powerful tool, in your case the logic should be however pretty straightforward.

If your cover layer (channel 1, hence cover@1) has a value of 1 where you want to retain data from the LAI layer (channel 1, hence LAI@1) , and 0 where you want to discard them, the Expression could be very simple:

"cover@1" * "LAI@1"

(H/T Borgh)

If you want to create a mask (i.e. have null/empty pixels where cover is zero) a kind of hack can come in handy:

"LAI@1"/("cover@1">0)

Explanation:

  • if cover= 1 -> the output will be equal to LAI
  • if cover= 0 -> the output would be LAI/0, which is impossible, thus the Raster Calculator returns a null value.

To avoid errors and artifacts, make sure both layers have the same reference system and resolution ;)

  • Thanks, But I am not really good in this tool. Normally I do in arcmap. Could you please indicate more how the expression should be done? – Lia Sartika Nov 21 at 10:27
  • 2
    If I understand your OP well you want to "clip" the layer-2 vaues? In that case it is just layer-1 * layer-2. In cells where the classification is 1 you'll get vaules, in cells where it is 0 you'll get value*0 = 0 – Borgh Nov 21 at 10:31
  • Thanks @Borgh, it helps !!! – Lia Sartika Nov 21 at 12:02

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.