Right now, the process of getting weather info into my posts involves an extra step I would like to avoid. I would also like if my GPS logs contained weather info themselves, to avoid having to link up an external dataset to correlate that info.
It might make sense to add the weather info at the time the location records are created. If you add a DarkSky API key to Overland, then it could periodically fetch the weather info and add the data to the location records.
Here's an example weather record from my current weather DB:
{
"data": {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-122.62125708873,
45.535584429375
]
},
"properties": {
"timestamp": "2018-01-01T21:00:05Z",
"location_date_utc": "2018-01-01 20:56:37 +0000",
"location_timezone": "America/Los_Angeles",
"location_accuracy": null,
"temp_f": 43.5,
"humidity": "64",
"pressure_mb": "1029",
"feelslike_f": "41",
"description": "Clear",
"icon": "clear",
"wind_mph": 5,
"wind_gust_mph": "10.0",
"precip_1hr_metric": "0"
}
}
}
Some notes about how this could work:
- Keep a cached copy of the latest weather info on the phone
- If more than 5 minutes has elapsed since the weather was last updated, fetch new weather info
- If the distance from the last weather update changes by more than 5km, fetch new weather info
- For every location point recorded, add the weather info from the cache
- Include the timestamp of the weather info so consumers will know how old the weather info is
Since the properties
object in GeoJSON can include full JSON (not limited to key/value pairs), we can store the weather info in a new nested object weather
containing these properties.