zonal_statistics
Compute raster statistics within vector zones using exact fractional pixel coverage, with automatic CRS alignment and optional weighted statistics.
Instructions
Statistics of a raster within each vector zone (exact fractional pixel coverage).
stats: subset of count/sum/mean/median/min/max/stdev/variance/majority/minority/
variety (default: count, mean, min, max). Zones are aligned to the raster CRS
automatically; the decision is recorded in the provenance manifest.
weights_path: a single-band raster of weights on the SAME grid as the values
(same CRS, cells and registration; otherwise refused with how to align it),
for weighted_mean/weighted_sum/weighted_stdev/weighted_variance/weighted_frac --
e.g. mean heat per zone weighted by population (default stats then: count,
mean, weighted_mean). A cell with a value and no weight counts with weight 0,
and the record names the zones where that happened.
Zones without a CRS are refused; warnings and repairs keys in the result
flag a suspicious outcome or geometry MapSmith had to repair.
Requires the [raster] extra.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"raster_path": "<raster_path>",
"zones_path": "<zones_path>",
"output_path": "<output_path>"
},
"name": "zonal_statistics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stats | No | ||
| zones_path | Yes | ||
| output_path | Yes | ||
| raster_path | Yes | ||
| weights_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||