TransWikia.com

Create single-band thematic raster in Google Earth Engine from multi-band image

Geographic Information Systems Asked by rpr_mt on August 6, 2020

I am working on translating some models a colleague created in ERDAS Imagine into Google Earth Engine. The model specifics in Imagine are largely irrelevant but the general steps are:

  1. Perform a tasseled cap transformation on a Landsat scene and retain brightness, greenness, and wetness.
  2. Reclassify the 3-bands into bins (1 through 8) representing each pixel’s deviation from the mean, scaled by the standard deviation of the whole image.
  3. Combine these 3 bands into a single band image with 512 classes where the value represents a unique combination of brightness, greenness and wetness binned values. For instance, if in the 3-band image the brightness/greenness/wetness bin values of a pixel were 1/3/5, the single-band image should display a value of 135 for that pixel.

I have succeeded in getting the first two steps to work but now need to create the final image with the 512 discrete classes. How can I accomplish this in GEE? I have tried using .and(), .cat() and explored if I could convert the band values to strings prior to using the .add() function but have come up empty.

Code below is not very useful but will hopefully provide an example of the products I need to combine.

// binned, discrete brightness image
var brightness_bp8 = ee.Image('users/ryanpatrickrock/SAL_lcTimeSeries/raster/boulder_07132017_brightness_bp8')
                      .clip(ROI)
// Map.addLayer(brightness_bp8, {min: 1, max: 8}, 'brightness')

// binned, discrete greenness image
var greenness_bp8 = ee.Image('users/ryanpatrickrock/SAL_lcTimeSeries/raster/boulder_07132017_brightness_bp8')
                      .clip(ROI)
// Map.addLayer(greenness_bp8, {min: 1, max: 8}, 'greenness')

// binned, discrete wetness image
var wetness_bp8 = ee.Image('users/ryanpatrickrock/SAL_lcTimeSeries/raster/boulder_07132017_wetness_bp8')
                      .clip(ROI)
// Map.addLayer(wetness_bp8, {min: 1, max:8}, 'wetness')

// 3 band image of all binned values
var bp_cat = ee.Image.cat(brightness_bp8, greenness_bp8, wetness_bp8)
// print(bp_cat)
// Map.addLayer(bp_cat)

One Answer

I think the easiest way to do this would be to just use band math:

var thematic = brightness_bp8.multiply(ee.Image(100))
                .add(greenness_bp8.multiply(ee.Image(10)))
                .add(wetness_bp8);

Good luck with the model!

Answered by Jean on August 6, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP