0

I am trying to weghted overlay in Google Earth Engine I want to overlay PDSI, SPI and SMI applying weights for each parameter.

This is how I am going to overlay them:

var overlay = spi.add(smi.add(pdsi))

How do I apply weighted overlay?

2
  • 1
    Can you specify your question please: How exactly do you want to apply weighted overlay? Using one fixed weight per layer? Do you need to re-organize your layers into categories, and if yes how? Is this a conceptual example of want you want to do, and how would you modify it to your specific application? Commented Aug 8, 2021 at 13:28
  • I do this based on AHP. Each layer has a specific weight. I want to apply weight to each parameter then overlay together to create a new image. ex: SPI * 0.25, PDSI*0.14
    – Chathu_T
    Commented Aug 9, 2021 at 5:38

1 Answer 1

1

You can use GEE's ee.Image.expression() function for more complex mathematical operations like both addition and multiplication as in your case (more info e.g. here and here). As it works on an ee.Image, you need to combine your layers into one at first using ee.Image.addBands().

Example code (factors need to be adjsted accordingly):

var image = spi.addBands(smi).addBands(pdsi)
var overlay = image.expression(
    '2 * spi + 5 * smi + 1.5 * pdsi', {
      'SPI': image.select('spi'),
      'SMI': image.select('smi'),
      'PDSI': image.select('pdsi')
});

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.