Zonal Statistics As Table
- URL:https://<rasteranalysistools-url>/ZonalStatisticsAsTable
- Related Resources:Add Image, Calculate Density, Calculate Distance, Calculate Travel Cost, Classify, Classify Pixels Using Deep Learning, Convert Feature to Raster, Convert Raster to Feature, Copy Raster, Cost Path As Polyline, Create Image Collection, Create Viewshed, Delete Image, Delete Image Collection, Detect Objects Using Deep Learning, Determine Optimum Travel Cost Network, Determine Travel Cost Paths to Destinations, Determine Travel Cost Path as Polyline, Distance Accumulation, Distance Allocation, Export Training Data for Deep Learning, Fill, Flow Accumulation, Flow Direction, Flow Distance, Generate Raster, Install Deep Learning Model, Interpolate Points, List Deep Learning Model Info, Nibble, Optimal Path As Line, Optimal Path As Raster, Optimal Region Connections, Query Deep Learning Model Info, Segment, Stream Link, Summarize Raster Within, Train Classifier, Uninstall Deep Learning Model, Watershed
- Version Introduced:10.8.1
Description
The ZonalStatisticsAsTable task summarizes the cells of a raster within the boundaries of zones defined by another dataset.
You can think of ZonalStatisticsAsTable as taking two layers, one that defines specific zones and another that defines the value of each location across the whole area, and calculating some summary statistic for all of the values that fall within each particular area. The layer that defines the areas, inputZoneRasterOrFeatures, is a raster or feature dataset that defines the boundaries of each of the zones for which a summary values will be calculated. If the zone layer is a raster, it must have an integer data type. If the zone is a feature layer, it can contain overlapping polygons, where the zonal analysis will be performed for each individual feature. The area defining the values, the inputValueRaster, is a raster dataset recording the value of some particular property at each location.
The statistic can report such properties as the sum of all the values in each area, the maximum value, or the average value. The statisticType can be calculated based on some mathematical function, the result of a sorting operation on the values, or an indication of the frequency values.
Some example applications of ZonalStatisticsAsTable include:
- Given a layer of state boundaries and the distribution of mean precipitation over the continental United States, calculate the state-wise distribution of extreme rain events using a list of percentile values.
- Given a layer of overlapping ecological zones and a raster layer of soil moisture, calculate all supported statistics within each zone to relate zones with soil moisture availability.
Request parameters
Parameter | Details |
---|---|
inputZoneRasterOrFeatures (Required) |
The layer the defines the boundaries of the zones. Syntax: This parameter can have either a raster input or a feature input. For raster input, this parameter can be specified as a portal item ID, a URL to a raster image service layer, a cloud raster dataset, or a shared raster dataset. For feature input, this parameter can be specified as either a URL to a feature service layer or a feature collection. Raster input examples:
Feature input examples:
|
inputValueRaster (Required) |
Choose the raster layer you wish to summarize by the zones defined by the inputZoneRasterOrFeatures. Syntax: This parameter can be specified as a portal item ID, a URL to a raster image service layer, a cloud raster dataset, or a shared raster dataset. Examples:
|
outputTableName (Required) |
The output table feature service name that will be created. You can specify the name, or you can create an empty service using Portal Admin Sharing API and use the return JSON object as input to this parameter. Syntax: A JSON object describes the name of the output or the output table. Output name example:
Output table examples:
|
zoneField (Required) |
A field on the inputZoneRasterOrFeatures that holds the values that define each zone. It can be an integer or a string field of the zone dataset. Example:
|
ignoreNodata | Specify whether NoData in the raster layer to summarize will influence the results of the areas they fall within. Syntax: A Boolean value as either true or false.
Example:
|
statisticType |
The statistical summary type that you wish to calculate for all the cells within each zone of the feature in the inputValueRaster. Syntax: The input can be one of the following:
If the inputValueRaster is floating-point type, the zonal calculations for MAJORITY, MINORITY, and VARIETY cannot be computed. Example:
|
percentileValues | Specify the percentile value to calculate. The default is 90, for 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 approximately the same result as the median statistic. This option is only supported if the statisticsType parameter is set to PERCENTILE or ALL. A single or a list of Double value that can range from 0 to 100. Example:
|
processAsMultidimensional |
Specify how the input rasters will be processed if they are multidimensional. Syntax: A Boolean value as either true or false.
Example:
|
percentileInterpolationType | Specifies the method of percentile interpolation to be used when the number of values from the input raster to be calculated are even.
Example:
|
context | Contains additional settings that affect task execution. This task has the following settings:
|
f | The response format. The default response format is html. Values: html | json | pjson |
Response
When you submit a request, the task assigns a unique job ID for the transaction.
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}
After the initial request is submitted, you can use the jobId to periodically check the status of the job and messages as described in Checking job status. Once the job has successfully completed, you use the jobId to retrieve the results. To track the status, you can make a request of the following form:
https://<raster analysis tools url>/ZonalStatisticsAsTable/jobs/<jobId>
When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:
https://<raster analysis tools url>/ZonalStatisticsAsTable/jobs/<jobId>/results/outputTable
Example usage
Below is a sample request URL for ZonalStatisticsAsTable.
https://services.myserver.com/arcgis/rest/services/System/RasterAnalysisTools/GPServer/ZonalStatisticsAsTable/submitJob
JSON response syntax
The response returns the outputTable output parameter, which has properties for parameter name, data type and value. The content of the value is always the output tavle itemID and the feature service URL.
{
"paramName": <parameter name>,
"dataType": "GPString",
"value": {
"itemId": <item Id>,
"url": <URL>
}
}
JSON response example
{
"paramName": "outputTable",
"dataType": "GPString",
"value": {
"url": "https://<server name>/server/rest/services/Hosted/<service name>/FeatureServer/0",
"itemId": "351fe8441a1a436d8001124487b02550"
}
}