Endpoint Detail: Polygon
This page provides detailed information about the polygon endpoint. This is used to query (aggregated) data from within a polygon overlaying a raster layer.
The TerraClim layers can be queried by providing a polygon WKT
string in WGS84 format. Multiple polygons should be separated by ; (semicolon), while queries are
limited
to a maximum of 5 polygons each.
You must include aggregationMethod in the options when querying.
This specifies how you want to aggregate the pixels within the polygon.
Available options are min, mean, max.
Polygons cannot have an area that is larger than 2 square kilometers. You will receive an error message if
you try to query a polygon that is too large
The valid dataTypes are listed below, along with the available sub data types per variable,
what dates are available, what date range to use, and the available extent for a variable,
| Data type | Sub data type | Date range & format | Extent |
|---|---|---|---|
| temp |
|
|
TerraClim extent |
| gdd |
|
|
TerraClim extent |
| chill |
|
|
TerraClim extent |
| frost | - | Monthly | TerraClim extent |
| rain (long term layers) | monthly_median | - monthly_median: 12 long term layers (1 to 12 representing each month) | SA extent |
| windspeed | 20, 50, 100, 150 | Single layer per height (not dated) | SA extent |
Polygon Chill DPCU Request
POST https://api.terraclim.co.za/api/polygon/
{
"dataType": "chill",
"options": {
"subDataType": "dpcu",
"aggregationMethod": "min",
"timeScale": "annual",
"dataExtent": "sa"
},
"wkts": "MultiPolygon (((...)))",
"startDate": "2016",
"endDate": "2017"
}
Polygon Chill DPCU Response
Status: OK (200)
Content-Type: application/json
{
"MultiPolygon (((...)))": {
"2016": 574.5,
"2017": 696.5
},
"MultiPolygon (((...)))": {
"2016": 501.5,
"2017": 615.5
}
}
Polygon Windspeed Request
POST https://api.terraclim.co.za/api/polygon/
{
"dataType": "windspeed",
"options": {
"subDataType": "20",
"aggregationMethod": "mean",
"dataExtent": "sa"
},
"wkts": "POLYGON((...))"
}
Polygon Windspeed Response
Status: OK (200)
Content-Type: application/json
{
"POLYGON((...))": 4.582824419287362
}