Skip to content

Real-time road closure recommendations with the OS Data Hub

17 Aug 2021
Ordnance Survey
developersos data hubAPIs

As a member of our Rapid Prototyping team, Freja Hunt explains how she has used the OS Data Hub to explore techniques to suggest locations for road closures in real-time...

Where emergencies threaten public safety, it is sometimes necessary to close roads in the surrounding area as part of forming a safety cordon until the incident is resolved. In urban areas, where there may be many routes to reach the same location, ensuring all routes are effectively blocked can increase the time it takes to secure an area.

Inspired by the possibilities for OS data to support time-critical decisions, I wanted to explore techniques to suggest suitable locations for road closures in real-time. This idea grew from comments made during a previous project for a business specialising in chemical, biological, nuclear and radiological incident modelling and could support first responders, emergency services and the armed forces in future. As part of the Data Science Accelerator programme run by the Government Data Science Partnership, I developed a prototype web app where the user can specify a location and a minimum safe distance, then instantly view an interactive map showing optimised recommendations for road closures.

To provide real-time suggestions, the system uses on-demand data from the OS Data Hub via the OS Features API. When a user clicks on a location on the map, the location coordinate and selected cordon parameters are sent from the web app to a python script via Flask. The python script uses the user specified maximum cordon distance to calculate a bounding box around the clicked coordinate. This bounding box covers the minimum cordon area, plus a buffer zone of roads that could be closed to prevent access inside the cordon. Using the “get_all_features_within_bbox” method from OS-PAW, which is a python wrapper for the OS Features API, a request is sent to the OS Data Hub for all the roads within this bounding box.

System screenshot.

The OS road data is structured so the roads can easily be treated as an interconnected network around which traffic can “flow”. The algorithm examines the network to find an optimal set of road closures that prevent any flow within the minimum safe distance from the cordon centre. Starting from these suggested closures, the user can then apply their expertise and local knowledge to devise a plan for their incident response.

Building on this, there are additional ways OS data might be integrated to support an incident response. For example, using the OS Places API, the system could report the address and coordinates of all residential properties within the cordon, enabling efficient evacuation of the area; using the Features API to query the OS MasterMap Sites Layer, all schools and hospitals within the area could be identified, with the associated access and routing points used to coordinate assisting vulnerable individuals; or the OS MasterMap Topography Layer accessed via the Features API could be used to suggest locations suitable for decontamination facilities or casualty triage stations.

What is the Rapid Prototyping team?

OS’s Rapid Prototyping team is a small team of data scientists who apply their creative problem-solving skills at pace to trial new concepts in close partnership with customers.

If you are interested in knowing more or think a system like this could support your work, please get in touch via Twitter or!

Discover our Developer site now to find out more about how the OS Data Hub and our APIs can support you.

Ordnance Survey
By Ordnance Survey
Press Office

Sharing the latest news about OS. We can license you to use OS maps in print, online and film format. For more information and resources for journalists, bloggers and media professionals, email or call 023 8005 5565.