I am trying to work on weighted overlay analysis in Google Earth Engine Python API. I have reclassified my layers and tryting to assign weights for each of my selected indicators. Getting errors. Could anybody suggest appropriate ways to do so.

Sample code:

overlay = image.expression(
    ('0.6 * slopereclass) + (0.4 * elevationreclass))', {
    'Slopereclass': image.select('slopereclass'),
    'elevationreclass': image.select('elevationreclass')   
where `slopereclass` is reclassified slope and `elevationreclss` is reclassified elevation.
  • What errors are you getting?
    – PolyGeo
    Mar 30, 2022 at 2:10
  • EEException: Image.parseExpression, argument 'expression': Invalid type. Expected type: String. Actual type: List<Object>. Actual value: [0.6 * slopereclass) + (0.4 * elevationreclass)), {Slopereclass=<Image<[constant]>>, elevationreclass=<Image<[constant_1]>>}] @polygeo Mar 30, 2022 at 2:19
  • Please use the edit button beneath your question to revise it with any requested clarifications.
    – PolyGeo
    Mar 30, 2022 at 4:02

1 Answer 1


Your first quote is in the wrong place. It should be outside the parentheses.

'(0.6 * slopereclass) + (0.4 * elevationreclass)'
  • stil getting the same error. I am pasitng my whole codes here: I have two layers slope and elevation. I reclassified them and tyring to build a overlaid image: slopereclass = ee.Image(1) \ .where(slope.gt(10).And(slope.lte(20)), 2) \ .where(slope.gt(20).And(slope.lte(30)), 3) \ Mar 30, 2022 at 16:56

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.