Endpoint Detail: Polygon-aggregate
This page provides detailed information about the /poly-aggregate endpoint. The data from multiple weather stations can be aggregated by providing a polygon. The data from all stations within that polygon will be aggregated (averaged), provided they are available for the selected dates. Only a single polygon can be provided per query.
Data types
The dataTypes parameter in the body must be a list of items. Even if querying a single item.
The number of dataTypes is limited to 5 per query.
Available data types differ per time scale, please refer to the table below:
| Time scale | Available data types |
|---|---|
| Hourly | temperature_mean, temperature_min, temperature_max, rain, solar_radation, sunshine_duration, wind_direction, leaf_wetness, wind_speed_max, wind_speed, evaporation, dew_point, humidity, humidity_min, humidity_max |
| Daily | temperature_mean, temperature_min, temperature_max, temperature_median, rain_sum, solar_radiation_sum, sunshine_duration_sum, wind_direction_mean, wind_direction_median, humidity_mean, humidity_min, humidity_max, humidity_median, leaf_wetness_mean, leaf_wetness_median, leaf_wetnes_min, leaf_wetness_max, wind_speed_mean, wind_speed_min, wind_speed_max, evaporation_sum, dew_point_mean, dew_point_median, dew_point_min, dew_point_max, rain_mean, rain_min, rain_max, solar_rad_std_sum, solar_rad_std_mean, solar_rad_std_min, solar_rad_std_max, et0 |
| Monthly | temperature_mean, temperature_min, temperature_max, temperature_median, rain_sum, solar_radiation_sum, sunshine_duration_sum, wind_direction_mean, wind_direction_median, humidity_mean, humidity_min, humidity_max, humidity_median, leaf_wetness_mean, leaf_wetness_median, leaf_wetnes_min, leaf_wetness_max, wind_speed_mean, wind_speed_min, wind_speed_max, evaporation_sum, dew_point_mean, dew_point_median, dew_point_min, dew_point_max, rain_mean, rain_min, rain_max, solar_rad_std |
Time scales
When querying the nearest station data, a timeScale parameter must be provided in
the options dictionary of the body. Available options are one of the following: "hourly", "daily", "monthly".
The date formats for querying the different time scales are as follows:
| Time scale | Date format |
|---|---|
| Hourly | yyyy-mm-ddThh:mm:ss (where the mm:ss should always be 00:00 as you are only querying hourly data. Hours are from 00:00:00 (midnight) - 23:00:00) |
| Daily | yyyy-mm-dd |
| Monthly | yyyy-mm |
Polygon Aggregate Daily Request
POST https://api.terraclim.co.za/api/poly-aggregate/
{
"dataTypes": ["temperature_mean", "humidity_max", "temperature_min"],
"options": {
"timeScale": "daily"
},
"wkts": "MultiPolygon (((18.91671791165536831 -33.89855763915434039, 18.92460126899314687 -33.8991747706631017, 18.92366561799598657 -33.90373358084075761, 18.91665818925129372 -33.90365395096866052, 18.91671791165536831 -33.89855763915434039)))",
"startDate": "2022-10-06",
"endDate": "2022-10-08"
}
Polygon Aggregate Daily Response
Status: OK (200)
Content-Type: application/json
{
"stations_metadata": {
"0": {
"station_lat": -33.9025,
"station_lon": 18.9192,
"station_elevation": null
},
"1": {
"station_lat": -33.9014,
"station_lon": 18.9208,
"station_elevation": null
},
"2": {
"station_lat": -33.902184,
"station_lon": 18.923724,
"station_elevation": 443.1
},
"3": {
"station_lat": -33.902,
"station_lon": 18.9221,
"station_elevation": null
}
},
"aggregated_data": {
"2022-10-06": {
"temperature_mean": 12.529672181177848,
"temperature_mean_station_count": 4,
"humidity_max": 94.82,
"humidity_max_station_count": 1,
"temperature_min": 9.810439748764038,
"temperature_min_station_count": 4
},
"2022-10-07": {
"temperature_mean": 14.688077529799891,
"temperature_mean_station_count": 4,
"humidity_max": 89.42,
"humidity_max_station_count": 1,
"temperature_min": 8.780518522262573,
"temperature_min_station_count": 4
},
"2022-10-08": {
"temperature_mean": 17.533807679158095,
"temperature_mean_station_count": 4,
"humidity_max": 84.04,
"humidity_max_station_count": 1,
"temperature_min": 13.977020292282106,
"temperature_min_station_count": 4
}
}
}
Polygon Aggregate Monthly Request
POST https://api.terraclim.co.za/api/poly-aggregate/
{
"dataTypes": ["rain_sum"],
"options": {
"timeScale": "monthly"
},
"wkts": "MultiPolygon (((18.91671791165536831 -33.89855763915434039, 18.92460126899314687 -33.8991747706631017, 18.92366561799598657 -33.90373358084075761, 18.91665818925129372 -33.90365395096866052, 18.91671791165536831 -33.89855763915434039)))",
"startDate": "2022-10",
"endDate": "2022-11"
}
Polygon Aggregate Daily Response
Status: OK (200)
Content-Type: application/json
{
"stations_metadata": {
"0": {
"station_lat": -33.9025,
"station_lon": 18.9192,
"station_elevation": null
},
"1": {
"station_lat": -33.9014,
"station_lon": 18.9208,
"station_elevation": null
},
"2": {
"station_lat": -33.902184,
"station_lon": 18.923724,
"station_elevation": 443.1
},
"3": {
"station_lat": -33.902,
"station_lon": 18.9221,
"station_elevation": null
}
},
"aggregated_data": {
"2022-10-01": {
"rain_sum": 2.5000000000000004,
"rain_sum_station_count": 2
},
"2022-11-01": {
"rain_sum": 6.0,
"rain_sum_station_count": 2
}
}
}