This raster analysis portal tool is available when you are signed in to an ArcGIS Enterprise portal that has ArcGIS Image Server configured for Raster Analysis. When the tool is run, ArcGIS Pro serves as a client and the processing occurs in the servers federated with ArcGIS Enterprise. The portal tool accepts layers from your portal as input and creates output in your portal.
The input raster layer supports a layer from the portal, a URI or URL to an image service, or the output from the Make Image Server Layer tool. The input feature layer can be a layer from the portal or a URI or URL to a feature service. This tool does not support local raster data or layers. While you can use local feature data and layers as input to this portal tool, best practice is to use layers from your portal as input.
A zone is defined as all areas in the input that have the same value. The areas do not have to be contiguous. Both rasters and features can be used for the zone input.
If the Input Zone Raster or Features parameter value (inputZoneRasterOrFeatures in Python) is a raster, it must be an integer raster.
If the zone is a feature, it will be converted to a raster internally using the cell size and cell alignment from the Input Value Raster parameter (inputValueRaster in Python).
If the cell size or cell alignment of the Input Zone Raster or Features and Input Value Raster parameter values are different, the Input Value Raster value will be used as the cell size and the snap raster internally. Either of these cases will cause an internal resampling before the zonal operation is performed.
When the zone and value inputs are both rasters of the same cell size and the cells are aligned, they will be used directly in the tool and will not be resampled internally during tool processing.
If a particular zone from the Input Zone Raster or Features parameter value does not overlap any cell centers of the Input Value Raster parameter value, the zone will become NoData in the output. You can manage this by determining an appropriate value for the Cell Size environment that will preserve the necessary level of detail of the zone input and specifying this in the cell size environment. Specifying a smaller cell size will generate a larger output raster. The higher resolution output will not necessarily be as high quality a result, since the additional detail does not exist in the value raster.
If the Input Zone Raster or Features parameter value has overlapping polygons, the zonal analysis will not be performed for each individual polygon. Since the feature input is converted to a raster, each location can have only one value.
An alternative method is to process the zonal operation iteratively for each polygon zone and collate the results.
If the Input Zone Raster or Features parameter value is a point feature, more than one point may be contained within any particular cell of the input value raster. For such cells, the zone value is determined by the point with the lowest ObjectID field (for example, OID or FID).
When specifying the Input Zone Raster or Features parameter value, the default zone field will be the first available integer or text field. If no other valid fields exist, the ObjectID field (for example, OID or FID) will be the default.
The supported statistic type depends on the data type of the Input Value Raster parameter value, and the statistic calculation type specified by the Calculate Circular Statistics parameter.
If the data type is integer, the arithmetic statistics calculation supports the Mean, Majority, Majority count, Majority percentage, Maximum, Median, Minimum, Minority, Minority count, Minority percentage, Percentile, Range, Standard deviation, Sum, and Variety options. The circular statistics calculation supports the Mean, Majority, Majority count, Majority percentage, Minority, Minority count, Minority percentage, Standard deviation, and Variety options.
If the data type is float, the arithmetic statistics calculation supports the Mean, Maximum, Median, Minimum, Percentile, Range, Standard deviation, and Sum options. The circular statistics calculation supports the Mean and Standard deviation options.
For majority and minority calculations, when there is a tie, the output will be the lowest of the tied values.
To calculate circular statistics, check the Calculate Circular Statistics parameter (circularCalculation = "CIRCULAR" in Python), and specify a value for the Circular Wrap Value parameter (circularWrapValue in Python).
|
Label
|
Explanation
|
Data type
|
|
Input Zone Raster or Features
|
The input that defines the zones.
Both raster and feature data can be used for the zone input.
|
Raster Layer; Feature Layer
|
|
Zone Field
|
The field that contains the values that define each zone.
It can be an integer or a string field of the zone dataset.
|
String
|
|
Input Value Raster
|
The raster that contains the values for which to summarize a statistic.
|
Raster Layer
|
|
Output Name
|
The name of the output raster service.
If the image service layer already exists, you will be prompted to provide another name.
|
String
|
|
Statistic Type
(Optional)
|
Specifies the statistic type that will be calculated.
The available options when the value raster is integer are Mean, Majority, Majority count, Majority percentage, Maximum, Median, Minimum, Minority, Minority count, Minority percentage, Percentile, Range, Standard deviation, Sum, and Variety.
If the value raster is float, the options are Mean, Maximum, Median, Minimum, Percentile, Range, Standard deviation, and Sum.
Mean—The average of all cells in the value raster that belong to the same zone as the output cell will be calculated. This is the default.
Majority—The value that occurs most often for all cells in the value raster that belong to the same zone as the output cell will be calculated.
Majority count—The frequency of all cells that contain the majority value in the value raster that belong to the same zone as the output cell will be calculated.
Majority percentage—The percentage of cells that contain the majority value in the value raster that belong to the same zone as the output cell will be calculated.
Maximum—The largest value of all cells in the value raster that belong to the same zone as the output cell will be calculated.
Median—The median value of all cells in the value raster that belong to the same zone as the output cell will be calculated.
Minimum—The smallest value of all cells in the value raster that belong to the same zone as the output cell will be calculated.
Minority—The value that occurs least often for all cells in the value raster that belong to the same zone as the output cell will be calculated.
Minority count—The frequency of all cells that contain the minority value in the value raster that belong to the same zone as the output cell will be calculated.
Minority percentage—The percentage of cells that contain the minority value in the value raster that belong to the same zone as the output cell will be calculated.
Percentile—The percentile of all cells in the value raster that belong to the same zone as the output cell will be calculated. The 90th percentile is calculated by default. You can specify other values (from 0 to 100) using the Percentile Value parameter.
Range—The difference between the largest and smallest value of all cells in the value raster that belong to the same zone as the output cell will be calculated.
Standard deviation—The standard deviation of all cells in the value raster that belong to the same zone as the output cell will be calculated.
Sum—The total value of all cells in the value raster that belong to the same zone as the output cell will be calculated.
Variety—The number of unique values for all cells in the value raster that belong to the same zone as the output cell will be calculated.
|
String
|
|
Ignore NoData in Calculations
(Optional)
|
Specifies whether NoData values in the value input will be ignored in the results of the zones that they fall within.
Checked—Within any particular zone, only cells that have a value in the input value raster will be used in determining the output value for that zone. NoData cells in the value raster will be ignored in the statistic calculation. This is the default.
Unchecked—Within any particular zone, if NoData cells exist in the value raster, they will not be ignored and their existence indicates that there is insufficient information to perform statistical calculations for all the cells in that zone. Consequently, the entire zone will receive the NoData value.
|
Boolean
|
|
Process as Multidimensional
(Optional)
|
Specifies how the input rasters will be processed if they are multidimensional.
Checked—Statistics will be calculated from the current slice of the input multidimensional dataset. This is the default.
Unchecked—Statistics will be calculated for all dimensions (such as time or depth) from all slices of the multidimensional input dataset.
|
Boolean
|
|
Percentile Value
(Optional)
|
The percentile that will be calculated. The default is 90, indicating the 90th percentile.
The values can range from 0 to 100. The 0th percentile is essentially equivalent to the minimum statistic, and the 100th percentile is equivalent to maximum. A value of 50 will produce essentially the same result as the median statistic.
This parameter is only available when calculating percentile.
|
Double
|
|
Percentile Interpolation Type
(Optional)
|
Specifies the method of interpolation that will be used when the percentile value falls between two cell values from the input value raster.
Auto-detect—If the input value raster is of integer pixel type, the Nearest method will be used. If the input value raster is of floating point pixel type, the Linear method will be used. This is the default.
Nearest—The nearest available value to the desired percentile will be used. In this case, the output pixel type is the same as that of the input value raster.
Linear—The weighted average of the two surrounding values from the desired percentile will be used. In this case, the output pixel type is floating point.
|
String
|
|
Calculate Circular Statistics
(Optional)
|
Specifies how the statistics type will be calculated.
Checked—Arithmetic statistics will be calculated. This is the default.
Unchecked—Circular statistics that are appropriate for cyclic quantities will be calculated, such as compass direction in degrees, daytimes, and fractional parts of real numbers.
|
Boolean
|
|
Circular Wrap Value
(Optional)
|
The highest possible value (upper bound) in the cyclic data. It is a positive number, with a default value of 360. This value also represents the same quantity as the lowest possible value (lower bound).
This parameter is only applicable when circular statistics are calculated.
|
Double
|
Derived output
|
Label
|
Explanation
|
Data type
|
|
Output Raster
|
The output raster.
|
Raster Layer
|
arcpy.ra.ZonalStatistics(inputZoneRasterOrFeatures, zoneField, inputValueRaster, outputName, {statisticType}, {ignoreNodata}, {processAsMultidimensional}, {percentileValue}, {percentileInterpolationType}, {circularCalculation}, {circularWrapValue})
|
Name
|
Explanation
|
Data type
|
|
inputZoneRasterOrFeatures
|
The input that defines the zones.
Both raster and feature data can be used for the zone input.
|
Raster Layer; Feature Layer
|
|
zoneField
|
The field that contains the values that define each zone.
It can be an integer or a string field of the zone dataset.
|
String
|
|
inputValueRaster
|
The raster that contains the values for which to summarize a statistic.
|
Raster Layer
|
|
outputName
|
The name of the output raster service.
If the image service layer already exists, you will be prompted to provide another name.
|
String
|
|
statisticType
(Optional)
|
Specifies the statistic type that will be calculated.
The available options when the value raster is integer are MEAN, MAJORITY, MAJORITY_COUNT, MAJORITY_PERCENT, MAXIMUM, MEDIAN, MINIMUM, MINORITY, MINORITY_COUNT, MINORITY_PERCENT, PERCENTILE, RANGE, STD, SUM, and VARIETY.
If the value raster is float, the options are MEAN, MAXIMUM, MEDIAN, MINIMUM, PERCENTILE, RANGE, STD, and SUM.
MEAN—The average of all cells in the value raster that belong to the same zone as the output cell will be calculated. This is the default.
MAJORITY—The value that occurs most often for all cells in the value raster that belong to the same zone as the output cell will be calculated.
MAJORITY_COUNT—The frequency of all cells that contain the majority value in the value raster that belong to the same zone as the output cell will be calculated.
MAJORITY_PERCENT—The percentage of cells that contain the majority value in the value raster that belong to the same zone as the output cell will be calculated.
MAXIMUM—The largest value of all cells in the value raster that belong to the same zone as the output cell will be calculated.
MEDIAN—The median value of all cells in the value raster that belong to the same zone as the output cell will be calculated.
MINIMUM—The smallest value of all cells in the value raster that belong to the same zone as the output cell will be calculated.
MINORITY—The value that occurs least often for all cells in the value raster that belong to the same zone as the output cell will be calculated.
MINORITY_COUNT—The frequency of all cells that contain the minority value in the value raster that belong to the same zone as the output cell will be calculated.
MINORITY_PERCENT—The percentage of cells that contain the minority value in the value raster that belong to the same zone as the output cell will be calculated.
PERCENTILE—The percentile of all cells in the value raster that belong to the same zone as the output cell will be calculated. The 90th percentile is calculated by default. You can specify other values (from 0 to 100) using the percentileValue parameter.
RANGE—The difference between the largest and smallest value of all cells in the value raster that belong to the same zone as the output cell will be calculated.
STD—The standard deviation of all cells in the value raster that belong to the same zone as the output cell will be calculated.
SUM—The total value of all cells in the value raster that belong to the same zone as the output cell will be calculated.
VARIETY—The number of unique values for all cells in the value raster that belong to the same zone as the output cell will be calculated.
|
String
|
|
ignoreNodata
(Optional)
|
Specifies whether NoData values in the value input will be ignored in the results of the zones that they fall within.
DATA—Within any particular zone, only cells that have a value in the input value raster will be used in determining the output value for that zone. NoData cells in the value raster will be ignored in the statistic calculation. This is the default.
NODATA—Within any particular zone, if NoData cells exist in the value raster, they will not be ignored and their existence indicates that there is insufficient information to perform statistical calculations for all the cells in that zone. Consequently, the entire zone will receive the NoData value.
|
Boolean
|
|
processAsMultidimensional
(Optional)
|
Specifies how the input rasters will be processed if they are multidimensional.
CURRENT_SLICE—Statistics will be calculated from the current slice of the input multidimensional dataset. This is the default.
ALL_SLICES—Statistics will be calculated for all dimensions (such as time or depth) from all slices of the multidimensional input dataset.
|
Boolean
|
|
percentileValue
(Optional)
|
The percentile that will be calculated. The default is 90, indicating the 90th percentile.
The values can range from 0 to 100. The 0th percentile is essentially equivalent to the minimum statistic, and the 100th percentile is equivalent to maximum. A value of 50 will produce essentially the same result as the median statistic.
This parameter is only available when calculating percentile.
|
Double
|
|
percentileInterpolationType
(Optional)
|
Specifies the method of interpolation that will be used when the percentile value falls between two cell values from the input value raster.
AUTO_DETECT—If the input value raster is of integer pixel type, the NEAREST method will be used. If the input value raster is of floating point pixel type, the LINEAR method will be used. This is the default.
NEAREST—The nearest available value to the desired percentile will be used. In this case, the output pixel type is the same as that of the input value raster.
LINEAR—The weighted average of the two surrounding values from the desired percentile will be used. In this case, the output pixel type is floating point.
|
String
|
|
circularCalculation
(Optional)
|
Specifies how the statistics type will be calculated.
ARITHMETIC—Arithmetic statistics will be calculated. This is the default.
CIRCULAR—Circular statistics that are appropriate for cyclic quantities will be calculated, such as compass direction in degrees, daytimes, and fractional parts of real numbers.
|
Boolean
|
|
circularWrapValue
(Optional)
|
The highest possible value (upper bound) in the cyclic data. It is a positive number, with a default value of 360. This value also represents the same quantity as the lowest possible value (lower bound).
This parameter is only applicable when circular statistics are calculated.
|
Double
|
Derived output
|
Name
|
Explanation
|
Data type
|
|
outputRaster
|
The output raster.
|
Raster Layer
|
Code sample
ZonalStatistics example 1 (Python window)
This example determines for each zone the mean of cell values in the raster layer to be summarized.
import arcpy
arcpy.ra.ZonalStatistics('https://MyPortal.esri.com/server/rest/services/Hosted/landuse/ImageServer',
'Landuse', 'https://MyPortal.esri.com/server/rest/services/Hosted/elevation/ImageServer',
'outRaster', 'MEAN', 'DATA')
ZonalStatistics example 2 (stand-alone script)
This example determines for each zone the statistic value in the raster layer to be summarized.
#----------------------------------------------------------------------------
# Name: ZonalStatistics_Ex_02.py
# Description: Calculates the maximum sea-surface temperature for different
# ecological zones.
# Requirements: ArcGIS Image Server
# Import system modules
import arcpy
# Set local variables
inputZoneRasterOrFeatures = 'https://MyPortal.esri.com/server/rest/services/Hosted/zones/ImageServer'
inputValueRaster = 'https://MyPortal.esri.com/server/rest/services/Hosted/seaSurfaceTemperature/ImageServer'
outputName = 'outSSTRaster'
zoneField = 'temperature'
statisticType = 'MAXIMUM'
ignoreNodata = ''
processAsMultidimensional = 'ALL_SLICES'
# Run Multidimensional ZonalStatistics operation
arcpy.ra.ZonalStatistics(inputZoneRasterOrFeatures, zoneField,
inputValueRaster, outputName, statisticType,
ignoreNodata, processAsMultidimensional)