Stay organized with collections Save and categorize content based on your preferences.
Apply a reducer to all the pixels in a specific region.

Either the reducer must have the same number of inputs as the input image has bands, or it must have a single input and will be repeated for each band.

Returns a dictionary of the reducer's outputs.

Image.reduceRegion(reducer, geometry, scale, crs, crsTransform, bestEffort, maxPixels, tileScale)Dictionary
this: imageImageThe image to reduce.
reducerReducerThe reducer to apply.
geometryGeometry, default: nullThe region over which to reduce data. Defaults to the footprint of the image's first band.
scaleFloat, default: nullA nominal scale in meters of the projection to work in.
crsProjection, default: nullThe projection to work in. If unspecified, the projection of the image's first band is used. If specified in addition to scale, rescaled to the specified scale.
crsTransformList, default: nullThe list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with 'scale', and replaces any transform already set on the projection.
bestEffortBoolean, default: falseIf the polygon would contain too many pixels at the given scale, compute and use a larger scale which would allow the operation to succeed.
maxPixelsLong, default: 10000000The maximum number of pixels to reduce.
tileScaleFloat, default: 1A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g. 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.


Code Editor (JavaScript)

// A Landsat 8 surface reflectance image with SWIR1, NIR, and green bands.
var img = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_044034_20210508')
              .select(['SR_B6', 'SR_B5', 'SR_B3']);

// Santa Cruz Mountains ecoregion geometry.
var geom = ee.FeatureCollection('EPA/Ecoregions/2013/L4')
               .filter('us_l4name == "Santa Cruz Mountains"').geometry();

// Display layers on the map.
Map.setCenter(-122.08, 37.22, 9);
Map.addLayer(img, {min: 10000, max: 20000}, 'Landsat image');
Map.addLayer(geom, {color: 'white'}, 'Santa Cruz Mountains ecoregion');

// Calculate median band values within Santa Cruz Mountains ecoregion. It is
// good practice to explicitly define "scale" (or "crsTransform") and "crs"
// parameters of the analysis to avoid unexpected results from undesired
// defaults when e.g. reducing a composite image.
var stats = img.reduceRegion({
  reducer: ee.Reducer.median(),
  geometry: geom,
  scale: 30,  // meters
  crs: 'EPSG:3310',  // California Albers projection

// A dictionary is returned; keys are band names, values are the statistic.
print('Median band values, Santa Cruz Mountains ecoregion', stats);

// You can combine reducers to calculate e.g. mean and standard deviation
// simultaneously. The output dictionary keys are the concatenation of the band
// names and statistic names, separated by an underscore.
var reducer = ee.Reducer.mean().combine({
  reducer2: ee.Reducer.stdDev(),
  sharedInputs: true
var multiStats = img.reduceRegion({
  reducer: reducer,
  geometry: geom,
  scale: 30,
  crs: 'EPSG:3310',
print('Mean & SD band values, Santa Cruz Mountains ecoregion', multiStats);