Recently the Met Office http://www.metoffice.gov.uk/have made DataPoint available:
“DataPoint is a way of accessing freely available Met Office data feeds in a format that is suitable for application developers. It is aimed at professionals, the scientific community and student or amateur developers, in fact anyone looking to re-use Met Office data within their own innovative applications.”
This provides a respectable reliable source for some of our UK weather needs.
In my opinion, the two more interesting options for xml or json feeds are:
UK 3-hourly site-specific forecast
A quality controlled forecast out to 5 days for more than 5,000 (UK) locations. http://www.metoffice.gov.uk/datapoint/product/uk-3hourly-site-specific-forecast
UK hourly site-specific observations:
Hourly observations for the last 24 hours for approximately 140 locations across the UK. http://www.metoffice.gov.uk/datapoint/product/uk-hourly-site-specific-observations
The other options will be most useful in combination with map rendering as overlays from your favourite map provider, such as Bing Maps.
Apply for a free API key (with the usual fair use restrictions, which I believe, are very fair) and off we go.
Firstly we need to find our locationID so
Assuming we want Edinburgh then the response below gives us the id of 3166.
<Location elevation=”57.0“ id=”3166“ latitude=”55.928“ longitude=”-3.343“ name=”Edinburgh/Gogarbank“ region=”dg“ unitaryAuthArea=”Edinburgh“/>
Using this id we can retrieve the weather observations for the previous 24 hours. That’s the weather that has been, usually around as two hour delay. This is useful if we don’t have our own external sensor or weather station.
For reporting the delay is acceptable as it is all about trends and correlation with any information you may have, such as house temperatures ,retrieved in a previous blog.
To query the last 24 hour observations, for Edinburgh:
In Visual Studio we might load the output into as such.
Dim xd As New Xml.XmlDocument
Dim xr As XmlElement = xd.DocumentElement
Dim xv As XmlNodeList = xd.SelectNodes(“SiteRep/DV/Location/Period”)
Then we could parse the current day as:
For Each x As XmlNode In xv.Item(1)
Then we can get an attribute such as the Temperature (T) as below:
Finally we can report on the temperature and any other required weather observations such as humidity and pressure. In time we can build trends which with our other data that we’ve collected, such as house temperature. Then we can provide interesting insight. With more information such as electricity usage we can relate even more and have even more fun with our data.
My Take Away: Great Met Office Data Feed
Met Office DataPoint Data, XML and Visual Studio