Methods

OpenStreetMap data in Lupa

How Lupa derives overhead power lines and cable routes from OpenStreetMap, so that the method can be checked.

The Gridscan map in Lupa shows cable routes and, in some areas, overhead power lines that Lupa has derived from OpenStreetMap. Both are built from the Great Britain extract published by Geofabrik, which Geofabrik refreshes daily. Lupa downloads the extract every Monday at 01:00 UTC and rebuilds the power lines and the road network from it.

Power lines

Lupa shows OpenStreetMap power lines everywhere except inside the supply areas of UK Power Networks, Northern Powergrid and Electricity North West. In those areas Lupa shows the lines from the operators' own open data. In the areas of NGED, SP Energy Networks and SSEN, Lupa shows the OpenStreetMap lines.

The extract is reduced to power lines with osmium-tool:

osmium tags-filter great-britain-latest.osm.pbf w/power=line,minor_line -o power-lines.osm.pbf --overwrite

The remaining ways are then read with pyosmium and selected by voltage, as follows.

  • Only ways tagged power=line or power=minor_line are kept.
  • The voltage tag is read in volts ("11000") or with a unit ("11kV"). A way without a voltage tag is dropped, because its voltage is unknown.
  • A way is kept only when its voltage is from 6.6 kV to 66 kV inclusive. Lines above 66 kV and lines below 6.6 kV are dropped.
  • Where the tag lists several voltages ("33000;11000"), the lowest value that is within range is used. If no listed value is within range, the way is dropped.
  • A way with fewer than two nodes that have a known position is dropped.

For each kept way, Lupa stores only the OpenStreetMap way identifier, the voltage in kilovolts, whether the way is a line or a minor line, and the line geometry. No other tags and no contributor details are stored.

Each weekly run is stored separately and becomes the active data only once every line has been written. A run is refused, and the previous data stays in use, when it contains no lines or fewer than half the number of lines in the active run.

Road network for cable routes

Cable routes follow the road network. It is built from the same Great Britain extract, in the same weekly run, in the following steps.

  • Only ways with a highway tag are kept. Ferries and railways are therefore never part of a route.
  • Motorways are removed, that is, ways tagged highway=motorway or highway=motorway_link, because a cable route does not run along a motorway.
  • Valhalla, an open-source routing engine, builds its road graph from the remaining ways. Lupa also writes the same ways to files grouped by 10 kilometre squares of the British National Grid, which it uses to decide which parts of a route lie on a road.

The two filtering steps use osmium-tool as follows:

osmium tags-filter great-britain-latest.osm.pbf w/highway -o highways.osm.pbf --overwrite
osmium tags-filter -i highways.osm.pbf w/highway=motorway,motorway_link -o roads.osm.pbf --overwrite

To route from a site to a connection point, Lupa asks Valhalla for the shortest path that a car could drive. One-way streets and turn restrictions are ignored, because a cable is not a car. Lupa leaves Valhalla's access rules in force, so private roads, and tracks and paths that a car may not use, are not chosen as routes.

A route has up to three sections. The first runs from the site to the start of the road path and is labelled own site. The second is the road path itself. The third runs from the end of the road path to the connection point and is labelled off-road. A route is flagged when either of the two straight sections is longer than a warning distance set in Lupa. When Valhalla finds no path to a connection point, Lupa draws a straight off-road line instead and does not treat it as a routed connection.

The road path is then divided into steps of at most 10 metres. A step counts as road when at least half of its length lies within a set distance of a road, which is 15 metres by default. For this purpose the following highway values count as roads: trunk, primary, secondary, tertiary, unclassified, residential, service, living_street, road, pedestrian, footway and cycleway, together with the link forms of trunk, primary, secondary and tertiary. Tracks, paths, bridleways, steps, and proposed or abandoned ways count as off-road. A path that Valhalla follows along a track is therefore classed as off-road. A line drawn by hand is divided by the same rule.

Each weekly build is written to a new version and is used only once it is complete. Before Lupa switches to a new version, it checks that the new routing data answers route requests. It routes three ordinary journeys, in Birmingham, west London and Perth, and at least two of them must succeed. If the check fails, the build is refused and the previous version stays in use.

Licence

Lupa credits the data on its map with the words "© OpenStreetMap contributors".

OpenStreetMap data is available under the Open Database Licence (ODbL) 1.0. The OpenStreetMap copyright and licence page is at openstreetmap.org/copyright, and the text of the licence is at opendatacommons.org/licenses/odbl/1-0.

The power lines and the road network that Lupa derives from OpenStreetMap are available under the same licence, and this page describes the method that produces them.