Introduction
For more information, please read the block description.
Block type: PROCESSING
This block computes zonal statistics (e.g. mean, max, standard deviation, etc) for an input image or zoning map, both for visual and analytic products. The output is a GeoJSON file for each input image. The data.json
file of the output will also be populated with the computed statistics. For each band of the input image, statistics are computed, and the name of the variable follows the convention [band_number]_[stats_name]
. In addition, another file results_merged.geojson
is generated, which contains the results of all images and zones as a single file. Note that this file is not exposed as an output capability.
This block is particularly useful to extract information from raster data. For instance, one can compute the average NDVI values in certain fields, based on a set of NDVI raster files and on the vector files defining the geometry of each individual field.
Supported parameters
stats
: One or more of min, max, mean, sum, std, median, majority, minority, unique, range, nodata, percentile_[0-100], count. Default is["min", "max", "mean", "median", "std", "count"]
.zones
: Array ofPolygon
geometry, used as zones to calculate statistics for. Default is[]
, will use overall image geometry as only zone. CRS of geometry is required to beEPSG:4326
.zones_attribute_id
: Key ofFeature
to get unique identifier of the geometry to add to outputGeoJSON
file. Default is"zone_id"
, not required. Will use a sequential value (0 to length ofzones
- 1) if the key is not set inFeature
.
A list of Features
is what makes up a FeatureCollection
as defined by the GeoJSON
format. For instance, if you would pass this list as the zones
:
[
{
"type": "Feature",
"properties": {
"zone_id": "zone_A"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
13.360834121704102,
52.51846674522954
],
[
13.366670608520508,
52.51846674522954
],
[
13.366670608520508,
52.52060806001903
],
[
13.360834121704102,
52.52060806001903
],
[
13.360834121704102,
52.51846674522954
]
]
]
}
},
{
"type": "Feature",
"properties": {
"zone_id": "zone_B"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
13.365554809570312,
52.51481060072091
],
[
13.37087631225586,
52.51481060072091
],
[
13.37087631225586,
52.51705655410405
],
[
13.365554809570312,
52.51705655410405
],
[
13.365554809570312,
52.51481060072091
]
]
]
}
}
]
Your Zonal Statistics output for one of the images would be a FeatureCollection
as such:
{
"type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:EPSG::3857"
}
},
"features": [
{
"type": "Feature",
"properties": {
"zone_id": "A",
"1_mean": 0,
"2_mean": 0,
"3_mean": 0,
"4_mean": 0
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-833988.222014860599302,
4830765.350448431447148
],
[
-833047.463339990237728,
4830765.350448431447148
],
[
-833091.561402874765918,
4829692.297584908083081
],
[
-834002.921369155403227,
4829751.095002084039152
],
[
-833988.222014860599302,
4830765.350448431447148
]
]
]
}
},
{
"type": "Feature",
"properties": {
"zone_id": "B",
"1_mean": 0,
"2_mean": 0,
"3_mean": 0,
"4_mean": 0
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-831533.429847621009685,
4828104.767321062274277
],
[
-830283.984732558950782,
4827987.172486702911556
],
[
-830504.475046981591731,
4827208.10670907702297
],
[
-831695.12274486431852,
4827384.498960615135729
],
[
-831533.429847621009685,
4828104.767321062274277
]
]
]
}
}
]
}
You can make use of geojson.io to generate Feature
and FeatureCollection
.
Example parameters using the data block SPOT Display (Streaming) and calculating zonal statistics, mean or average, on the whole AOI:
{
"oneatlas-spot-aoiclipped:1": {
"bbox": [
13.405215963721279,
52.48480326228838,
13.4388092905283,
52.505278605259086
],
"ids": null,
"time": "2018-01-01T00:00:00+00:00/2019-12-31T23:59:59+00:00",
"limit": 1,
"zoom_level": 17,
"time_series": null,
"panchromatic_band": false
},
"zonal-statistics:1": {
"stats": ["mean"]
}
}
Output format
GeoJSON
file for each input image.
Capabilities
Input
Output
vector
up42_standard | |
---|---|
format | GeoJSON |
attributes | ${stats} |
geometry_type | Polygon |