I want to determine the 'global' minimum and maximum value for a calculated variable in Google Earth Engine. Essentially, my goal is to use a global geometry in reduceRegion(). However, Earth Engine complains when I use an unbounded geometry (image.geometry()) as my region argument. Is there a way to get the range of a calculated image in GEE?

Here is my code:

// Get global min and max of SPEI from TerraClim data///
// Get dataset
var terraClim = ee.ImageCollection('IDAHO_EPSCOR/TERRACLIMATE').filterDate('2017-10-01', '2018-09-30');
terraClim = terraClim.select('pr', 'pet');

// Calculate SPEI from the precipitation and potential evapotranspiration bands
var spei = terraClim.map(function(img){
  img = ee.Image(img);
  var pr = img.select("pr");
  var pet = img.select("pet");
  var spei = img.expression('pr - pet', {pr:pr,pet:pet});
  return img.select()
    .set('system:time_start', img.get('system:time_start'));

{min:-2000, max:100, palette:['white','red', 'orange', 'yellow', 'brown', 'green', 'blue', 'purple']}, 'spei');

// Get global min and max values of SPEI using reduceRegion
var spei_min = spei.first().reduceRegion({
  reducer: ee.Reducer.min(), 
  geometry: spei.geometry(), 
  bestEffort: true, 

var spei_max = spei.first().reduceRegion({
  reducer: ee.Reducer.max(), 
  geometry: spei.geometry(), 
  bestEffort: true, 
print('Global minimum SPEI:', spei_min);
print('Global maximum SPEI:', spei_max);

Here is the error I get when I try to print the resulting dictionaries:

Image.reduceRegion: Provide 'geometry' parameter when aggregating over an unbounded image.

Link to my code in code editor: https://code.earthengine.google.com/32957edb7eb0b4797b503dc7605a10b5

  • Short answer: no. You can try to select an area that's large enough to be representative (and still run) but GEE does not allow using the full extent of the image as the geometry.
    – M. Nicolas
    Commented Aug 30, 2022 at 20:11

1 Answer 1


Use ee.Geometry.BBox(-180, -90, 180, 90) as the geometry argument.

  • Using ee.Geometry.BBox worked beautifully! Thank you so much! Commented Sep 9, 2022 at 15:51

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.