Skip to main content

https://defradigital.blog.gov.uk/2015/03/27/exploring-rivers-of-data/

Exploring 'Rivers of Data'

Posted by: , Posted on: - Categories: Defra digital, Open data

This week saw the beta release of the Environment Agency's flood data APIs and 4 new open data products from Ordnance Survey including the detailed OS Open Map - Local and the new OS Open Rivers network data. Alex Coley's blog on Monday talked about exploring the potential as to how the Environment Agency and OS  data can be used together. So we tried just that.

A team led by Ordnance Survey had a brief exploration of how the new releases can be integrated, and both the OS and Environment Agency have come together for this blog to share thoughts on how that went.

So what did we find?

The Environment Agency API and the OS Open Rivers product were pulled into the OS OnDemand API for an area of Somerset. This was relatively easy to do because the supporting documentation for the Environment Agency API helped to give a good understanding about the information that each endpoint was returning.

The flood data API is designed so that you can get information from one endpoint and then go elsewhere for more information on individual features - so for a beginner it might be a bit tricky at first to get to grips with this to build an application. However, doing things this way does reduce the amount of JSON sent back in one hit, and gives you control over what you go and get next. So from a more experienced developer perspective this is good design, and not a problem.

The OS Open Rivers product is a simplified, connected network of Great Britain's watercourses that has been released in both GML and Shape formats. Once an area of features was selected and exported into a separate shapefile the product needed to be converted to geoJSON  to enable it to be used quickly within an OpenLayers application. Alternatively whole the dataset could be imported into a database and features sent to an application on demand. However, for a small area that wouldn't slow down the browser, converting the selection of features to geoJSON was the best route to take. This was easy to convert - QGIS allows you to save features from a shapefile layer into GeoJSON.

EA_OS1    EA_OS2

The blue network lines are from the OS Open Rivers product and the pink dots are Environment Agency monitoring stations. We were also able to query the data behind individual monitoring stations.

In terms of building a web mapping application, it was a fairly simple task to load the OS Open River data via OpenLayers' ability to load GeoJSON with ease. To load in the Environment Agency data some simple requests were made to the Beta API service to bring back a list of Monitoring Stations within a distance of a location, Flood Warnings (if any) for the area of Somerset, and a 3 Day Forecast (national) for floods. In the case of the Monitoring Stations and Flood Warnings further requests needed to be made to bring back the information for each individual warning or Monitoring station. This was a fairly simple process to build a loop to go and make the requests based off the data given in the original JSON response. Then it was just a case of working through those further responses to take the location data from the JSON and make OpenLayers vector features from them and add them to their respective layers. There were a few hurdles to get past, specifically with EA Monitoring Station features as they don’t all carry the same attribution, but a few simple key tests on the data solved that, and placeholders could be inserted where data was missing.

And what will you find?

With relatively straightforward integration of these new open data releases, two sets of government data can be brought together to enable a range of simple analyses and visualisation, that support a greater understanding of flood plains and measures in place to mitigate flooding. Hopefully these insights will provide encouragement to developers to pick up the data and have a further look.

Of course, the releases this week are beta, and so both the Environment Agency and Ordnance Survey would be very interested in your thoughts and feedback. We are especially keen to see your examples of how this week's releases work together, so please do get in touch to share your examples.

There are a number of ways you can do this:

via Twitter @dataenvagency and @ordnancesurvey

or by email to data.info@environment-agency.gov.uk and opendata@os.uk

Blog written by Paul Hyatt & Jess Dyer

Paul is the ‘National Lead’ for a range of data sharing activities at the Environment Agency, including transparency, licensing, technical developments & services. Jess is the 'Technical Product Manager' for Ordnance Survey’s Network Product portfolio.

Sharing and comments

Share this page