Calculate zonal statistics

Modified on Tue, 21 May at 2:34 PM

Use the Calculate zonal statistics block to calculate a single statistic for an entire area (or ‘zone’). For example, you may want to calculate the mean elevation for each feature in a collection.


This statistic can be added as a new band to an image collection (raster dataset) or added as an attribute to a feature collection (vector dataset).


Output zonal statistic as a new band in an image collection (raster dataset)

  1. Add the Calculate zonal statistics block into the workflow containing the image collection (raster dataset). The values from this image collection will be used to calculate the statistic. 
  2. Pick the band to use in your calculation with the Using band dropdown, 
  3. Use the Calculate the dropdown to choose a statistic. 
  4. Any feature collection or thematic image in your project can be selected with the Use zones from dataset dropdown:
    • All Areas of Interest: calculates a single statistic for all features in the Area of Interest
    • Collection: calculates a statistic for each of the features in a Collection
    • 1km grid: calculates a statistic for each 1 km square within the Area of Interest
  5. Name the band that you are creating


To use a thematic image or feature collection to define the zones, add a Save data for re-use block into the workflow containing the thematic image or feature collection. The dataset will then be available in the Use zones from dataset dropdown.


Make sure the Area of Interest covers the area you select in the Use zones from dataset dropdown.



Output zonal statistic as a new attribute in a feature collection (vector dataset)


  1. Add the Calculate zonal statistics block into the workflow containing the feature collection.
  2. In the Use dataset dropdown, select the image collection that you want to use in your calculation. To select the image collection in the dropdown, make sure you’ve added the Save dataset for re-use block to the workflow containing the image collection.
  3. Choose the band to use in your calculation from the Use band dropdown.
  4. Use the Calculate the dropdown to choose a statistic. 
  5. Choose which image within the image collection you want to use in your calculation.
  6. Name the attribute that you are creating


To combine multiple images to use in a calculation, use the Aggregate images in time block in the workflow containing your image collection.



Available statistics

  • Median: selects the middle value
  • Mean: creates an average from each value
  • Sum: calculates the total of all the values
  • Min: selects the minimum value
  • Max: selects the maximum value
  • Count: Counts every pixel that has a value (parts of an image that have been masked out won’t have a value)
  • Mode: select the most common pixel value
  • Standard Deviation: calculates the standard deviation of all the values
  • Variance: calculates the variance of all the values


The Calculate zonal statistics block is generally used with numeric bands to calculate the statistic. If you are using a thematic data band, then the “Mode” will usually be the most appropriate statistic. Note that the class “Value” (a number) will be produced as the output, not the class “Description” (a text string).


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article