Description
This tool summarizes the raster cell values that are contained by a polygon. The output consists of summary fields that are added to the polygon attribute table. It processes thematic (i.e. categorical) and continuous rasters in different ways. For thematic rasters, a new field is added for each unique value in the raster and is populated with either a count of the number of cells of each raster value within that polygon, or the proportion of cells of each raster value. For continuous rasters a statistical summary is produced (the mean, median, minimum, maximum, standard deviation, count, and the 95% quantiles).
Polygons are processed sequentially, so are not affected in any way by overlapping polygons (in contrast to related tools in ArcGIS). This means that it can take a considerable time to process many polygons.
This tool cannot distinguish between thematic and categorical rasters automatically. By default it assumes the raster represents continuous data, so if the raster is a thematic raster you must explicitly use the 'thematic=TRUE' option.
NoData cells are ignored. Therefore, if the polygon contains NoData cells this may influence the accuracy of the statistical summary. It is highly recommended you ensure that raster data exists for the entire area covered by the polygons. Any polygons that are entirely or partially outside of the extent of the raster will not be processed - they will be coded with NoData values (-2147483648) so should be easily identifiable.
Note that this single command provides the same functionality as the 'Zonal Statistics ++' and 'Thematic Raster Summary' tools in HawthsTools.
Syntax
isectpolyrst(in, raster, prefix, [thematic], [proportion], [where]);
| in | the input polygon data source | |
| raster | the input raster data source | |
| prefix | a short prefix to use in the summary statistic fields that are added, which end with MN, MIN, MAX, STD, CNT, MED for continuous raster data, and V# for thematic raster data where # is each of the unique cell values. The prefix should be no longer than 6 characters, and should be related in some way to the raster dataset. | |
| [thematic] | (TRUE/FALSE) controls whether the raster should be treated as a thematic (categorical) raster (default=FALSE) | |
| [proportion] | (TRUE/FALSE) only applies to thematic rasters: records the proportion of the polygon in each cell value rather than the area of the polygon (default=FALSE) | |
| [where] | the selection statement that will be applied to the feature data source to identify a subset of features to process (see full Help documentation for further details) |
Example
isectpolyrst(in="C:\data\fields.shp", raster="C:\data\landcov", prefix="LCOV", thematic=TRUE);
isectpolyrst(in="C:\data\plots.shp", raster="C:\data\landcov", prefix="LCOV", thematic=TRUE, proportion=TRUE);
isectpolyrst(in="C:\data\parcels.shp", raster="C:\data\dem", prefix="DEM");