2

I am trying to run the expression below in Google Earth Engine to calculate Index-base Built-up Index(IBI)

var ibi = l8compositeMasked.expression(
    '(2*SWIR/(SWIR+NIR)-((NIR/(NIR+RED))+(GREEN/(GREEN+SWIR)))) / (2*SWIR/(SWIR+NIR)+((NIR/(NIR+RED))+(GREEN/(GREEN+SWIR))))', {
      'RED':l8compositeMasked.select('B3'),
      'GREEN':l8compositeMasked.select('B4'),
      'NIR':l8compositeMasked.select('B5'),
      'SWIR':l8compositeMasked.select('B6')
    });

Map.addLayer(ibi, {min:-1, max:1}, 'ibi', false); 

but I keep getting the error below.

Layer shown property is not a boolean: ee.Image({
  "type": "Invocation",
  "arguments": {
    "DEFAULT_EXPRESSION_IMAGE": {

Below is the link to the script https://code.earthengine.google.com/bdb6397411fe912861900cba04bb9172

How can I resolve this?

2 Answers 2

1

The problem is in the last line of your script, not the line you have shown.

Map.addLayer(ibi,{min:-1 , max:1},'UI', ibi)

Here the fourth argument should be a boolean but is the image ibi.

1

Your last parameter in the Map.addLayer cal is the image again, not a name. This line:

Map.addLayer(ibi,{min:-1 , max:1},'UI', ibi)

should be:

Map.addLayer(ibi,{min:-1 , max:1},'UI', 'ibi')

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.