LogoLogo
OS Docs HomeOS NGDOS APIsOS Download ProductsMore than MapsContact Us
  • More than Maps
  • Geographic Data Visualisation
    • Guide to cartography
      • Introduction to cartography
      • Types of maps
      • Symbology
      • Colour
      • Text on maps
      • Generalisation
      • Coordinate reference systems
      • Projections
      • Scale
      • Map legends
      • Map layout
      • Relief representation
      • North arrows
    • Guide to data visualisation
      • Introduction to data visualisation
      • GeoDataViz design principles
      • Types of visualisation
      • Thematic mapping techniques
      • Data visualisation critique
      • Accessible data visualisation
      • Ethical data visualisation
      • Software
      • Data
    • GeoDataViz assets
      • GeoDataViz basemaps
      • Stylesheets
      • GeoDataViz virtual gallery
      • Equal area cartograms
      • How did I make that?
        • Apollo 11 Landing
        • North York Moors National Park, 70 years
        • Snowdonia National Park, 70 years
        • Great Britain's National Parks
        • Great Britain's Islands
        • Great Britain's AONB's and National Scenic Areas
        • Famous shipwrecks of Pembrokeshire
        • Trig pillars today
        • Britain's most complex motorway junctions
      • #30DayMapChallenge
  • Data in Action
    • Examples
  • Demonstrators
    • 🆕Product Viewer
    • Addressing & location demonstrators
      • Address Portfolio overview
      • Which address product should you use?
      • AddressBase
      • AddressBase Core
      • AddressBase Plus
      • AddressBase Premium
      • Address Classifications
      • Addressing Lifecycle
      • OS Emergency Services Gazetteer
      • What are Vertical Streets?
      • Why are there differences in boundaries?
    • Contextual demonstrators
    • Customer best practice
      • Channel Shift
      • Data Management and OS Data Hub
      • End User Licence vs Contractor Licence
      • 🆕 IDs vs Spatial Relationships
      • Why we should capture good quality addresses at source
      • Why we Snap and Trace
    • Network Demonstrators
      • OS Detailed Path Network
      • OS Multi Modal Routing Network
        • OS Multi Modal Routing Network
      • Water Networks overview
      • OS MasterMap Highways Network and OS NGD Speeds
      • OS MasterMap® Highways Network and OS Open Roads™
    • OS MasterMap Generation APIs
      • Using the OS Features API
      • Using the OS Features API Archive
      • Using the OS Downloads API
      • Using OS APIs in ESRI Software
    • 🆕OS NGD (National Geographic Database)
      • OS NGD Address
      • OS NGD Boundaries
      • 🆕OS NGD Buildings
        • 🆕Building and Building Access Feature Types
        • Building Part and Building Line Feature Types
      • 🆕OS NGD Geographical Names
      • OS NGD Land
      • OS NGD Land Cover enhancements
      • 🆕OS NGD Land Use
      • OS NGD Land Use enhancements
      • 🆕OS NGD Structures
        • 🆕OS NGD Structures
        • Field Boundaries
      • 🆕OS NGD Transport Features
      • 🆕OS NGD Transport Network
      • OS NGD Transport RAMI
      • OS NGD Water Features
      • OS NGD Water Network
      • OS NGD API - Features
      • Ordering OS NGD data
      • Change only updates
      • OS NGD Versioning
      • Creating a topographic map from OS NGD Data
      • Analytical styling for OS NGD data
    • OS MasterMap® demonstrators
    • 🆕Product & API Comparisons
      • 🆕Comparison of Water Network Products
  • Tutorials
    • GeoDataViz
      • Thematic Mapping Techniques
      • Downloading and using data from the OS Data Hub
      • How to download and use OS stylesheets
      • How to use the OS Maps API
      • Creating a bespoke style in Maputnik
    • GIS
      • Analysing pavement widths
      • Basic routing with OS Open Data and QGIS
      • Walktime analysis using OS Multi-modal Routing Network and QGIS
      • Creating 3D Symbols for GIS Applications
      • Constructing a Single Line Address using a Geographic Address
      • Creating a Digital Terrain Model (DTM)
      • Visualising a road gradient using a Digital Terrain Model
      • Visualising a road gradient using OSMM Highways
    • 🆕APIs
      • 🆕Using OS APIs with EPC API
      • 🆕OS APIs and ArcGIS
  • Deep Dive
    • Introduction to address matching
    • Guide to routing for the Public Sector
      • Part 1: Guide to routing
      • Part 2: Routing software and data options
      • Part 3: Building a routable network
    • Unlocking the Power of Geospatial Data
    • Using Blender for Geospatial Projects
    • A Guide to Coordinate Systems in Great Britain
      • Myths about coordinate systems
      • The shape of the Earth
      • What is position?
        • Types of coordinates
        • We need a datum
        • Position summary
      • Modern GNSS coordinate systems
        • Realising WGS84 with a TRF
        • The WGS84 broadcast TRF
        • The International Terrestrial Reference Frame (ITRF)
        • The International GNSS Service (IGS)
        • European Terrestrial Reference System 1989 (ETRS89)
      • Ordnance Survey coordinate systems
        • ETRS89 realised through OS Net
        • National Grid and the OSGB36 TRF
        • Ordnance Datum Newlyn
        • The future of British mapping coordinate systems
        • The future of British mapping coordinate systems
      • From one coordinate system to another: geodetic transformations
        • What is a geodetic transformation?
        • Helmert datum transformations
        • National Grid Transformation OSTN15 (ETRS89–OSGB36)
        • National Geoid Model OSGM15 (ETRS89-Orthometric height)
        • ETRS89 to and from ITRS
        • Approximate WGS84 to OSGB36/ODN transformation
        • Transformation between OS Net v2001 and v2009 realisations
      • Transverse Mercator map projections
        • The National Grid reference convention
      • Datum, ellipsoid and projection information
      • Converting between 3D Cartesian and ellipsoidal latitude, longitude and height coordinates
      • Converting between grid eastings and northings and ellipsoidal latitude and longitude
      • Helmert transformation worked example
      • Further information
  • Code
    • Ordnance Survey APIs
    • Mapping
    • Routing with pgRouting
      • Getting started with OS MasterMap Highways and pgRouting
      • Getting started with OS MasterMap Highways Network - Paths and pgRouting
      • Getting started with OS NGD Transport Theme and pgRouting
      • Getting started with OS NGD Transport Path features and pgRouting
  • RESOURCES
    • 🆕Data Visualisation External Resources
Powered by GitBook

Website

  • Ordnance Survey

Data

  • OS Data Hub
On this page

Was this helpful?

  1. Deep Dive
  2. Guide to routing for the Public Sector

Part 3: Building a routable network

PreviousPart 2: Routing software and data optionsNextUnlocking the Power of Geospatial Data

Last updated 1 year ago

Was this helpful?

These pages provide a guide to building a routable network using what are four of the most popular routing software packages used across the public sector. However, they are not intended to be a comprehensive guide to creating a network, or an endorsement of the packages. Please refer to the documentation for the specific software to be used. Furthermore, a working knowledge of the software is required before starting this type of analysis.

To simplify this the methodology has been broken down into sections: Before Starting, Network Analyst (ESRI), Routefinder, Cadcorp SIS and pg Routing to make it easier to jump to the section you are interested in.

Before starting to build a routable network there are several options to consider that will determine which data is required and which option is most appropriate to build your network.

  • What level of analysis is required? This will determine the level of detail in your network. If a high-level strategic overview is needed, then consider using OS OpenRoads data as the basis. However, if more detailed analysis, looking at service location and journey times is needed, this will require either OS MasterMap Highways or OS NGD Transport Network data.

  • What extent of data is required? Consider whether a network for Great Britain or just your local area is required. The bigger the area the longer it will take to build the network and the slower the analysis may be.

  • What additional data needs to be added? – For example, road speeds, bus stops for public transport networks and so on.

  • Some networks will be built with speed attributes set to nominal values which you may need to review and amend.

  • What type of analysis is required? For example, drive time buffers, A to B routing and so on

  • How to run the analysis? Typically, network analysis is memory intensive, and it may be more efficient to analyse the data in smaller batches or by using a smaller network.

  • How will the results be presented? Are the results going to be presented graphically in a report or do you just require a spreadsheet of values.

  • What are the processing requirements for the intended software?

OS MasterMap Highways Network

To use OSMM Highways in Network Analyst the data needs to be converted from GML into a Geodatabase. ESRI UK’s UK Data Loader will do this and create a network in the correct format. This includes incorporating the restriction and qualifiers into the data model. Once the network is built it can be added to either ArcMap or ArcGIS Pro with the Network Analyst Extension enabled for use. This typically creates a national network in approximately 30 hours (depending on hardware setup, information provided by ESRI UK).

Further details of the UK Data Loader can be find here - . The UK Data Loader requires ArcGIS Pro v3.0 or above and the Data Interoperability Extension for ArcGIS Pro. You will need to ensure that the versions in use are compatible with each other.


OS NGD Transport Network

To use the OS NGD data in Network Analyst the same tool as for Highways, UK Data Loader, is required. The tool converts the Geopackage into a FileGeodatabase containing an ESRI network dataset comprising all the network elements required. Depending on hardware set-up this will take approximately 36hrs to process a national data set. (Figures taken from the ESRI UK help document).


OS OpenRoads

OS OpenRoads is supplied as both GML and Shapefile. To create a network from the data you will first need to convert the Shapefiles into a Geodatabase by using ‘merge’ from ArcToolbox to create a new Feature Class. This needs to be within a Feature Dataset in the Geodatabase as you can only create networks at this level. Once completed you can build a network in ArcCatalog by opening your Geodatabase, right clicking on the Feature Dataset and selecting ‘New’ followed by ‘New Network Dataset’. The wizard will take you through the process, but as OpenRoads only contains geometry you can leave all other settings as default.

As this data contains fewer features than Highways the processing time is significantly reduced and a network can be created in a few hours.

A useful tutorial is available online explaining how to build a network and the different types of analyses - .

OS MasterMap Highways Network

This will produce a table of RoadLinks from which a network can be generated. RouteFinder is a tool which runs from within MapInfo. If the tool is not present on the Toolbar it can be found in MapInfo’s Tool Manager. Open your translated data in MapInfo and select ‘Network’ and ‘Create Network from Table’. Then choose the road table and click ‘OK’ to create the network. Processing a national set will take approximately a day to complete, depending on your hardware set up.

RouteFinder uses a route hierarchy based on road classification which is added to the data as an integer. The import tool will have added an attribute column containing these values to the data. In the ‘Select Network Attributes’ dialog set the ‘Attribute Column’ to road_class and height and width to the columns containing these values if present. Finally click ‘OK’ to create your network.


OS OpenRoads

OS OpenRoads is supplied as both GML and Shapefile, if you are using MapInfo v12.5 or newer the Universal Translator can be used to convert GML directly into TAB files. If you are using an older version than v12.5 then MapInfo can read shapefiles directly, however the data will need to be saved as a TAB file and merged into a single file.

Once a TAB file is created a new attribute, road_class will need to be added to the data to hold integer values for each road classification. The following query and update in MapBasic can be used to populate the new attribute.

Select * from RoadLink where roadClassification = "Motorway"  
Browse * From Selection 
Update Query1 Set road_class = 1 
Close Table Query1 Interactive 
Select * from RoadLink where roadClassification = "A Road" And formOfWay = "Collapsed Dual Carriageway" into Selection 
Browse * From Selection 
Update Query2 Set road_class = 2 
Close Table Query2 Interactive 
Select * from RoadLink where roadClassification = "A Road" And formOfWay = "Single Carriageway" into Selection 
Browse * From Selection 
Update Query3 Set road_class = 3 
Close Table Query3 Interactive 
Select * from RoadLink where roadClassification = "A Road" And formOfWay = "Roundabout" into Selection 
Browse * From Selection 
Update Query4 Set road_class = 2 
Close Table Query4 Interactive 
Select * from RoadLink where roadClassification = "B Road" And formOfWay = "Collapsed Dual Carriageway" into Selection 
Browse * From Selection 
Update Query5 Set road_class = 4 
Close Table Query5 Interactive 
Select * from RoadLink where roadClassification = "B Road" And formOfWay = "Single Carriageway" into Selection 
Browse * From Selection 
Update Query6 Set road_class = 5 
Close Table Query6 Interactive 
Select * from RoadLink where roadClassification = "B Road" And formOfWay = "Roundabout" into Selection 
Browse * From Selection 
Update Query7 Set road_class = 4 
Close Table Query7 Interactive 
Select * from RoadLink where roadClassification = "Unclassified"  
Browse * From Selection 
Update Query8 Set road_class = 6 
Close Table Query8 Interactive 
Select * from RoadLink where roadClassification = "Not Classified"  
Browse * From Selection 
Update Query9 Set road_class = 7 
Close Table Query9 Interactive 

Once the road_class attribute is added the data is ready for network conversion as described previously. However no additional attributes will be present in the data.

OS MasterMap Highways Network

Cadcorp includes tools for both loading the network data and creating a network data set. To add Highways as an overlay, select Ordnance Survey (GB) as the overlay type, Highways is included as part of OS (GB) Transport Network. Select the folder containing the data as either GML or Geopackage and the data is then converted, loaded and styled for use.

To create a network dataset for use with the Cadcorp routing tools use the OS Network Manager which is part of the Utilities on the file menu. This includes tools for adding both path and speed data.


OS NGD Transport Network

OS NGD Transport Network is loaded in the same way as for OSMM Highways Network. Select Ordnance Survey (GB) as overlay type as before and select the folder containing the Geopackage. The data is then converted, loaded and styled for use.

To create a network data set for use with the Cadcorp routing tools use the OS Network Manager which is part of the Utilities on the file menu. Again, this tool supports both path and speed data.

OS MasterMap Highways Network

Loading the data into pgRouting and building a network can be time consuming and will take 2 to 3 days to complete. The most efficient way to do this is by creating routines for each element of the build which can then be run overnight, leaving hardware and software free for other tasks during the day.


OS NGD Transport Network

OS NGD Transport data is available as both CSV or Geopackage which can be loaded directly into a PostGreSQL database. To create a network for use with pgRouting you will need:

  • NGD Transport Network Road Link

  • NGD RAMI Restriction - (which includes trn_rami_restriction and trn_rami_restriction_restrictnetworkref)

  • NGD RAMI Average and Indicative Speeds

Once loaded, as the data is very similar to OS MasterMap Highways, you will be able to follow the same instructions as for OS MasterMap Highways, amending them to fit your attributes as you work through the data.


OS OpenRoads

OS OpenRoads is delivered as Shapefiles which can be loaded directly into PostGIS using the PostGIS ‘Shapefile Import/Export Manager’. However, once loaded into PostGIS you will need to append the tables into one table to make the data easier to work with. To use the data in pgRouting you will also need to add the following columns to the data:

  • source (integer) – Contains the value of the start node for each link

  • target (integer) - Contains the value of the end node for each link

  • fid (serial) – Unique value for each link, used as a primary key

  • cost (double precision) – Cost value for traversing along the link

  • rcost (double precision) – Reverse cost value for traversing along the link

As the data contains references to the start and end nodes held in the roadnode table, the source and target columns can be populated using these values using an update query, removing the OSGB text and recasting the column.

The following SQL has been used to populate these values. However, some editing may be necessary to reflect differences in data structure. An additional column temp_id has also been added to make the conversion of the references easier.

UPDATE roadnode SET temp_id = trim(leading '#osgb' from gml_id ) :: Bigint; 

UPDATE roadlink set source_temp =trim(leading '#osgb' from l.startnode_xlink_href ) :: Bigint 

FROM roadlink AS l where l.gml_id = roadlink.fid; 

UPDATE roadlink set target_temp =trim(leading '#osgb' from l.endnode_xlink_href ) :: Bigint 

FROM roadlink AS l where l.gml_id = roadlink; 

The cost values can be set to either the road length or assigned an integer value dependent on the road classification.

Examples

With ever tighter financial pressures on Public Services a few Local Authorities have looked to using network analytics to improve services and reduce costs. Ordnance Survey has collected several cases studies demonstrating the use of the network data in route optimisation for waste collection and school bus routing. Full details of all Ordnance Survey case studies can be found at - .

Please note: This is a methodology and not an OS product. The methodology can be taken and adapted, but OS will not be maintaining this methodology.

To convert the Highways GML into a TAB file for use with RouteFinder a translator is available that can be downloaded from - . There are separate TAB files for both roads and paths data so both can be loaded together or as separate networks. Click ‘Add Files’ and select the GML for translation. To include the restrictions which are part of Highways you will need to check ‘TOID base (turn.txt)’ and click ‘Go!’.

There are several resources for loading data into PostGreSQL and making available to pgRouting. The data can be loaded into the database using the Astun Loader made available on GitHub - .

Creating a network for use with pgRouting involves running SQL queries in a PostGreSQL database with the PostGIS extension. Several useful resources are available on GitHub. This include a guide written by Ross MacDonald for pgRouting which can be found here - . As well as that of Tim Manners - .

Further details on pgRouting - .

http://www.routeware.dk/os_highways.php
https://github.com/AstunTechnology/Loader
https://github.com/mixedbredie/highways-for-pgrouting
https://github.com/tmnnrs
https://pgrouting.org/
https://www.esriuk.com/en-gb/arcgis/products/uk-data-loader/overview
http://webhelp.esri.com/arcgisdesktop/9.2/pdf/Network_Analyst_Tutorial.pdf
https://www.ordnancesurvey.co.uk/business-and-government/case-studies/index.html
Page cover image