I don't understand ee.Image.reduceRegion(). If I specify the region as a table containing multiple features, does it use the geometry of the first feature or all the features? The doc says the geometry is "The region over which to reduce data. Defaults to the footprint of the image's first band." But since I am reducing over a table and not image, I don't think this helps.

I have a shapefile containing multiple features. I created a dissolved version of it that has only one feature in QGIS. Then I uploaded both the original shapefile and the dissolved shapefile. I tried using ee.Image.reduceRegion() twice, one time using the original shapefile as geometry, and the other time using the dissovled shapefile as geometry. My reducer was linearRegression. The results were different. So I assume ee.Image.reduceRegion() takes only the first feature of the geometry parameter if it is a Table. But it wasn't specifically mentioned in the doc so I am not sure.

So just to restate the question: Does ee.Image.reduceRegion() reduce over all the (dissovled-like) features or just the first one when the geometry is a table containing multiple features?

Note I am not asking whether it gets a stat for each feature's geometry (I assume that is ee.Image.reduceRegions()), but rather does it get a stat for all of the features' geometries combined or just one of the feature's geometry.

1 Answer 1


reduceRegion() expects a geometry, not a collection. Whenever you pass a collection where a geometry is expected, all of the collection's features' geometries are retrieved and unioned.

So, all of the area covered by any of the collection's features will be included in the reduction (and not double-counted in the case of overlap).

This union can be an expensive operation with large collections or complex geometry, and it is good practice to avoid it if you don't need it. So for example, if you are reducing with ee.Reducer.sum() and your feature collection is large, it would be best to use reduceRegions() and sum the results, rather than to use reduceRegion() on a collection.

  • In that case why was the result for the dissolved and original shapefile different? The goemetry of dissolved and union features should be the same, right? I suppose it could be because the dissolved shapefile was too big, and GEE had to break it to more than one feature, and maybe something happened there. I would have to check.
    – Sara
    Nov 24, 2021 at 0:31
  • Also, could you please provide the doc reference to "Whenever you pass a collection where a geometry is expected, all of the collection's features' geometries are retrieved and unioned". Thanks!
    – Sara
    Nov 24, 2021 at 0:34
  • @Sara Unfortunately, I don't know of a single page explaining the issue at this time. ee.FeatureCollection.geometry does document the behavior and performance consideration, but I don't know if it's documented that that is the same operation used whenever a collection considered as a feature is asked for its geometry.
    – Kevin Reid
    Nov 24, 2021 at 16:49

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.