Skip to content

raileasyuk/railway-gis-data

Repository files navigation

Railway GIS data

This combines GIS data from various sources to create a good enough compilation of data for the UK rail network.

Data sources

Usage

Import the geopackage (Tracks and Nodes.gpkg) into your favourite GIS software, and start exploring!

Screenshot of the GeoPackage imported into ArcGIS Pro

Contents

The geopackage file includes a copy of Network Rail's VectorLinks and VectorNodes GIS data, which represents the entire Network Rail (and more) managed rail infrastructure in the UK. It also includes the TIPLOC data from YATIPLOCL, which has had its nodes snapped to the Network Rail data.

VectorNodes are found at every point where two different track assets intersect. These can be used to create a graph of track assets, which can be used to calculate routes between points. It's important to make use of these VectorNodes rather than only using the polylines otherwise you may calculate routes that jump from a tunnel to a bridge where track passes over each other, for example.

Each VectorNode that comes from one of the TIPLOC data sources listed above contains associated metadata. Generated nodes created from intersecting track segments contain null values for these fields.

Key Description Example
stop_id The TIPLOC code associated with the node, or null THBDWRS
stop_code The CRS code associated with the node, or null XTB
stop_name The name of the location associated with the node from its original data source, or null THREE BRIDGES VOYAGER M.D.
stop_url The data source for the metadata associated with the node, or null woodpecker
stop_lon The longitude data for the node, or null -0.163163
stop_lat The latitude data for the node, or null 51.112761

Screenshot of vector node metadata in ArcGIS Pro

In addition, each track segment retains some source metadata from the Network Rail track geometry data, including the engineering line reference and internal "track id".

Screenshot of polyline metadata in ArcGIS Pro

networkGraph.json

The entire network graph is stored in JSON format in networkGraph.json.

The file represents which VectorNodes are linked to which other VectorNodes and the ID of the line which connects them. The line ID can be used to look up the individual Lat/Lon points which make up the line, and its distance in centimetres.

An example pathfinding tool written in Go which makes use of this graph file is available in ./pathfinder, which expects a hard-coded list of TIPLOCs to route between as a testPath variable. This will output a geojson file with the calculated path. Please note that paths are not always correct as they rely on the accuracy of snapped-to-rail-geometry TIPLOC data.

Graph structure:

{
  "nodesGraph": {
    "1": [
      {
        "nodeId": 52,
        "viaLineId": 16804
      },
      {
        "nodeId": 9778,
        "viaLineId": 1680
      }
      // ...
    ]
    // ...
  },
  "tiplocToNodeIds": {
    "KEYMERJ": 1
    // ...
  },
  "nodeMetadata": {
    "1": {
      "lon": -0.144,
      "lat": 50.924
    }
    // ...
  },
  "trackMetadata": {
    "16804": {
      "lengthCentimetres": 123456,
      "lineString": [
        {
          "lat": 50.924,
          "lon": -0.144
        }
        // ...
      ]
    }
    // ...
  }
}

Changes

Thirteen VectorNodes have been removed from the dataset. These nodes were unconnected to any VectorLines, and were likely remnants of previous tracks in the dataset which were removed.

Removed IDs: 4660, 9334, 14123, 14128, 18978, 18988, 18997, 23817, 28468, 33309, 33310, 38164, 38192

Considerations

  • Multiple TIPLOCs may be mapped to the exact same position. This may be due to data limitations, or may be intentional. I actually just don't know. 🤷
  • Newark Flat Crossing has VectorNodes for where the lines cross, but it's not possible for trains to move between the East Coast Main Line and the Nottingham — Lincoln line.
    • It may be decided to remove these nodes in the future to prevent inaccurate route calculations. Provided you use TIPLOCs as well, this shouldn't present issues.
  • TIPLOCs may be snapped such that it is impossible to calculate a route from A to B, or doing so requires trains to use the wrong line.
    • Using the fake centre line data was initially explored, however the polylines do not always intersect cleanly in this data, presenting problems with calculating routes.
    • In the future, use of OpenStreetMap data instead may be preferred.

Licensing

About

Various GIS data relating to UK railways

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published