2

The Google Earth Engine API doc has function to get max value of some bands. But how to get the max value of one image?

2
  • Hello and welcome! You want the max at each pixel across all the bands (a single-band image output) or the single number that is the max of all values in all pixels in all bands (number as output)?
    – J Kelly
    Dec 24, 2018 at 21:09
  • Thanks,I want the single max at one band. For example,get the max value from a Landsat 8 red band.I can use the 'quick stats' to get the single max value of one band in ENVI. But,i don't know how to get that in GEE.
    – J.Frank
    Dec 25, 2018 at 2:52

1 Answer 1

7

.reduceRegion works if the geometry is reasonably small.

https://code.earthengine.google.com/8d71b1f03571c4510be90381928f3925 (I drew a polygon region.)

var RedBandIMAGE   = ee.Image( 'LC8_L1T_TOA/LC80410362015107LGN00' ).select( ['B4'] );
var maxReducer = ee.Reducer.max();
var theMax = RedBandIMAGE.reduceRegion(maxReducer, geometry);
print(theMax);
Map.setCenter( -118.2733, 34.0942, 12 ); 
Map.addLayer( RedBandIMAGE,   {min:0, max:0.17, palette:'000000,ff5555'},     'RedImage'   );
1
  • 1
    What about large geometries?
    – OscarBau
    Jun 1, 2021 at 15:44

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.