com.esri.arcgis.geoprocessing.tools.spatialanalysttools
Class ZonalStatisticsAsTable
java.lang.Object
com.esri.arcgis.geoprocessing.AbstractGPTool
com.esri.arcgis.geoprocessing.tools.spatialanalysttools.ZonalStatisticsAsTable
- All Implemented Interfaces:
- GPTool
public class ZonalStatisticsAsTable
- extends AbstractGPTool
Summarizes the values of a raster within the zones of another dataset and reports the results to a table.
The Zonal Statistics as Table tool is contained in the Spatial Analyst Tools tool box.
Usage tips:
- A zone is defined as all areas in the input that have the same value. The areas do not have to be contiguous. Both raster and feature datasets can be used for the zone input.
- When the zone and value inputs are both rasters of the same resolution, they will be used directly.If the resolutions are different, an internal resampling is applied to make them match before the zonal operation is performed.Should there be any NoData cells in the inputs, the resampling may cause there to be larger areas of NoData in your output than you might have expected. To avoid this situation, either the coarser input rasters to the resolution of the finer input raster, or set the to Minimum Of Inputs in the Raster Analysis .
- If the zone input is a raster dataset, it must have an attribute table. The attribute table is usually created automatically for integer rasters, but may not be under certain circumstances. You can use to create one.
- If the zone input is a feature dataset, a vector-to-raster conversion will be internally applied to it. To ensure that the results of the conversion will align properly with the value raster, it is recommended that you check that the extent and snap raster are set appropriately in the environment settings and the raster settings.Since the internal raster must have an attribute table, an error will occur if one was not created in the conversion. If this happens, convert your feature dataset directly with or , (, and . Generate an attribute table for it as described in the previous tip and use the resulting raster as your Zone input.
- If the zone input is feature dataset with small features, keep in mind that the resolution of the information needs to be appropriate relative to the resolution of the value raster. If the areas of single features are similar to or smaller than the area of single cells in the value raster, in the feature-to-raster conversion some of these zones may not be represented.To demonstrate this, try converting the feature dataset to a raster with the appropriate feature-to-raster conversion tool and specify the resolution to be that of the Value raster. The result from this conversion will give an indication about what the default output of the zonal operation will be.If you have fewer results in the output than you expected, you need to determine an appropriate raster resolution that will represent the detail of your feature input, and use this resolution as the of the Raster Analysis Settings of the Environment.
- If the zone input is a point feature dataset, it is possible to have more than one point contained within any particular cell of the value input raster. For such cells, the zone value is determined by the point with the highest feature ID.
- If the zone feature input 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 only have one value.An alternative method is to process the zonal statistics iteratively for each of the polygon zones and collate the results.
- It is recommended to only use rasters as the zone input, as it offers you greater control over the vector-to-raster conversion. This will help ensure you consistently get the expected results.
- The input value raster can be either integer or floating point. However, when it is floating-point type, the zonal calculations for majority, median, minority, and variety will not be computed.
- For majority and minority calculations, when there is a tie, the output for the zone is based on the lowest of the tied values.
- A series of fields will be created in the output table. Value, count, area, min, max, range, sum, mean, and std fields will be created regardless of the input values. Majority, minority, median, and variety fields will only be created when the input value raster is integer.
- The data type for each value under the items in the output table is dependent on the zonal calculation being performed. See for the specific behavior of any statistic.
- The number of rows in the output table is the number of zones.
ZonalStatisticsAsTable
public ZonalStatisticsAsTable()
- Creates the Zonal Statistics as Table tool with defaults.
Initializes the array of tool parameters with the default values specified when the tool was created.
ZonalStatisticsAsTable
public ZonalStatisticsAsTable(Object inZoneData,
Object zoneField,
Object inValueRaster,
Object outTable)
- Creates the Zonal Statistics as Table tool with the required parameters.
Initializes the array of tool parameters with the values as specified for the required parameters and with the default values for the other parameters.
- Parameters:
inZoneData
- dataset that defines the zones. the zones can be defined by an integer raster or a polygon feature layer.zoneField
- field that holds the values that define each zone. it can be an integer or a string field of the zone dataset.inValueRaster
- raster that contains the values on which to calculate a statistic.outTable
- output table that will contain the summary of the values in each zone.
getInZoneData
public Object getInZoneData()
- Returns the Input raster or feature zone data parameter of this tool .
This parameter is dataset that defines the zones. the zones can be defined by an integer raster or a polygon feature layer.
This is a required parameter.
- Returns:
- the Input raster or feature zone data
setInZoneData
public void setInZoneData(Object inZoneData)
- Sets the Input raster or feature zone data parameter of this tool .
This parameter is dataset that defines the zones. the zones can be defined by an integer raster or a polygon feature layer.
This is a required parameter.
- Parameters:
inZoneData
- dataset that defines the zones. the zones can be defined by an integer raster or a polygon feature layer.
getZoneField
public Object getZoneField()
- Returns the Zone field parameter of this tool .
This parameter is field that holds the values that define each zone. it can be an integer or a string field of the zone dataset.
This is a required parameter.
- Returns:
- the Zone field
setZoneField
public void setZoneField(Object zoneField)
- Sets the Zone field parameter of this tool .
This parameter is field that holds the values that define each zone. it can be an integer or a string field of the zone dataset.
This is a required parameter.
- Parameters:
zoneField
- field that holds the values that define each zone. it can be an integer or a string field of the zone dataset.
getInValueRaster
public Object getInValueRaster()
- Returns the Input value raster parameter of this tool .
This parameter is raster that contains the values on which to calculate a statistic.
This is a required parameter.
- Returns:
- the Input value raster
setInValueRaster
public void setInValueRaster(Object inValueRaster)
- Sets the Input value raster parameter of this tool .
This parameter is raster that contains the values on which to calculate a statistic.
This is a required parameter.
- Parameters:
inValueRaster
- raster that contains the values on which to calculate a statistic.
getOutTable
public Object getOutTable()
- Returns the Output table parameter of this tool .
This parameter is output table that will contain the summary of the values in each zone.
This is a required parameter.
- Returns:
- the Output table
setOutTable
public void setOutTable(Object outTable)
- Sets the Output table parameter of this tool .
This parameter is output table that will contain the summary of the values in each zone.
This is a required parameter.
- Parameters:
outTable
- output table that will contain the summary of the values in each zone.
getIgnoreNodata
public String getIgnoreNodata()
- Returns the Ignore NoData in calculations parameter of this tool .
This parameter is denotes whether NoData values in the Value input will influence the results of the zone that they fall within.
This is an optional parameter.
- Returns:
- the Ignore NoData in calculations
setIgnoreNodata
public void setIgnoreNodata(String ignoreNodata)
- Sets the Ignore NoData in calculations parameter of this tool .
This parameter is denotes whether NoData values in the Value input will influence the results of the zone that they fall within.
This is an optional parameter.
- Parameters:
ignoreNodata
- denotes whether NoData values in the Value input will influence the results of the zone that they fall within.
getToolName
public String getToolName()
- Returns the name of this tool.
- Returns:
- the tool name
getToolboxName
public String getToolboxName()
- Returns the name of the tool box containing this tool.
- Returns:
- the tool box name
getToolboxAlias
public String getToolboxAlias()
- Returns the alias of the tool box containing this tool.
- Returns:
- the tool box alias