Home > Software engineering >  How to create images by calculating other images in Google Earth Engine?
How to create images by calculating other images in Google Earth Engine?

Time:11-07

I have some categorical images (Max, Min, MinUp, C) in GEE. Each image has integer values in different ranges. For example, C is [0, 35], and Max is [1, 20] etc.

I want to create a Boolean image: pixels that meet any two of the following criteria have a value of 1, while other pixels get 0. What I can think of is that I do 3 overlays of (1,2) (1,3) &(2,3) and take the union. Is there a sophisticated way to create the Boolean map?

  1. Max < 3.

  2. Min < MinUp/3

  3. C < 5

CodePudding user response:

I didn't get an answer before I worked it out, so I am just gonna post mine here. I don't think it's sophisticated enough for more complicated conditions, but at least it's an one-line code for me.

var result = (C1.multiply(C2)).max((C1.multiply(C3)).max(C2.multiply(C3)));
  • Related