[Talk-GB] Importing NaPTAN Data

Ed Loach edloach at gmail.com
Fri Jul 5 10:50:45 UTC 2019

Silent Spike wrote:
> Would be curious to learn more about your route maintenance process. 
> I have a list of local bus route relations I've been meaning to update, but 
> it's hard to do so without all of the stops mapped (hence my desire to 
> import the available data).

The application I wrote and use is available on github and has some (perhaps now a bit dated) notes on use available there:
The develop branch (above link) is what I'm currently using - I've not created a recent release to incorporate bug fixes, so should probably do so when I get a moment. I think there might be a current bug relating to adding new areas that aren't added in the default locations file on first run, so should probably fix that first.

I've avoided the recent tagging discussions emails. The app is written to validate against the adopted PT v2 schema as documented in the wiki, with additions to handle tagging noted in either the wiki or on this list dating from the time of the previous naptan stop import, and that I completely don't care about public_transport=stop_position. E.g. I have a "surveyed" property based on the various tags discussed previously: physically_present, flag, kerb, timetable_case and shelter (which I've taken as signs the imported stop has been physically surveyed, though typing this now I wonder if I should exclude shelter like I do layby as it can possibly be determined from aerial imagery - I just know I haven't locally):
(this is in the method that takes the OSM XML and converts it into one of by BusStop objects).

Basically it compares the OSM data with the Opendata and I try and fix discrepancies manually, either tweaking the route relations that have changed or by adding new route variants if required. I have occasionally been rate limited by overpass since I added a hyperlink column to zoom to a stop, rather than doing click on naptancode cell, ctrl-c, switch to JOSM, ctrl-f, ctrl-v, enter, check whether more than one node has been selected (as for example 1500IM111 might match all these without adding extra bits after ctrl-v: 1500IM111, 1500IM1110, 1500IM1111, 1500IM1112, 1500IM1112Y, 1500IM1114, 1500IM1114Y, 1500IM1115, 1500IM1116, 1500IM1117, 1500IM1117Y, 1500IM1117YB, 1500IM1117YC, 1500IM1119) - if I get limited I just take a break for a while.

The application isn't clever enough to know when a particular route variant runs, so if you run it at an unfortunate time you might find you add all the current route variants and all the ones that replace them starting soon so are also in the file, and next time you run the application have to delete half of what you added the previous time. A recent route change did give me forewarning of when a new roundabout on the A120 was about to open when a new route variant appeared, changing from the old route as it passed through a village near the new roundabout, to head northwest towards the roundabout instead of north to the gap in the dual carriageway that was due to close when the roundabout opened.


This email has been checked for viruses by Avast antivirus software.

More information about the Talk-GB mailing list