Geographic Information Systems Asked on April 2, 2021
I am trying to segment the images based on the threshold values. For instance, I want to put a threshold range between > 800 and < 1200, but with my existing code in Google Earth Engine, I can put the only one function at a time that is greater than, below is my code, how to define greater than and less than at the same time.
// Threshold the thermal band to set hot pixels as value 1, mask all else.
var hotspots = s2a.gt(3500) // i want put here both grater than and less than function
.selfMask()
.rename('hotspots');
// Display the thermal hotspots on the Map.
Map.addLayer(hotspots, {palette: 'FF0000'}, 'Hotspots');
Use the updateMask()
function:
var hotspots = s2a.updateMask(s2a.gt(800)).updateMask(s2a.lt(1200))
// set all values to 1 (instead of keeping the original values)
.gt(800).selfMask()
// rename the band
.rename('hotspots');
Correct answer by Kuik on April 2, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP