Google Summer of Code/2016/AcceptedProjects/PT Assistant
The goal of the plugin is to validate public transport routes against a set of criteria and, where possible, suggest ways to fix them.
- "Repeat last fix" menu item has been added to the Tools menu. It allows to apply the last fix of the stop-by-stop test to other routes that share the same route segment. The menu item is deactivated if the last fix is not available (e.g. no stop-by-stop error has been fixed yet) or if no other problematic routes share the same route segment.
- Criteria for the proximity of a stop_position and a platform to be classified as belonging to the same stop have been set more strictly: from 0.005 degrees to 0.002 degrees.
- Bug that caused a false positive when both the last and the pre-last stop were assigned to the same way has been fixed.
- Settings for the plugin (which determine whether the incomplete members of a route relation should be downloaded and whether the stop_area-related tests should be included into the testing) are now available in a tab under Edit => Preferences => Data Validator => PT_Assistant.
- Fix for the road type test and construction test has been changed, making it identical to the fix for the direction test: instead of deleting the wrong way(s), the plugin selects it/them, zooms in to the problem and opens a Relation Editor.
- The dialog that asked the user whether the problems found in the first testing stage (i.e. direction test, road type test and construction test) should be fixed automatically before proceeding with testing has been removed due to the changes in the fixes for these tests.
- The stop-by-stop error messages are now differentiated depending on whether 0, 1, or multiple variants for an automated fix are available.
- The coloring of the multiple fix suggestions has been improved, bugs fixed.
- Notification is displayed if the fix suggestion(s) is based on less strict criteria, i.e. when the equality of route segments is established based on the stop equality similarity (less strict) instead of the first/last way equality (more strict). The less strict criteria are only applied when no fix was found using the more strict criteria.
- User Xamanu has added stop_area-related tests.
- Segments from the list of correct segments are used to offer fixes
- Fix to the stop-by-stop procedure has been added which fixes the route segment by re-sorting and removing unneeded ways
- If there are several fixes available, the user is asked which fix should be adopted. The fixes are visualized in different colors in the pt_assistant layer. A fix can be selected by typing the corresponding letter
- In cases where there is only one fix available, JOSM zooms in to the problem and waits before the fix
- If no fix is available, then when the user presses the "fix" button for the "PT: Problem in the route segment" warning, JOSM zoom in to the problem and the Relation Editor opens with the problematic ways selected.
- Stop-to-way-assigner has been implemented to link stops to ways
- Validated route segments are added to a list of correct route segments
- New tests have been added with the following warning messages:
- PT: Stop not served
- PT: Problem in the route segment (fix available in case the list of correct route segments contains a segment that connects the two stops between which the error occurred)
- New tests have been added with the following warning messages:
- PT: Stop_position is not part of a highway or railway
- PT: Platform node should not be part of a highway or railway. (It can be part of a platform way, an amenity=shelter or even a building)
- PT: Road is under construction
- The oneway test now adds adjacent wrongly directed ways, some of which were not detected before
- The fix for the oneway test has been changed. Instead of deleting the problematic ways, it selects them, zooms in on them and opens a relation editor for the corresponding route relation
- The plugin creates an extra layer that shows a more distinct styling (purple with white triangles showing oneway streets) for the currently selected route of public transport version 2. If no such route is currently selected, the styling indicates the last selected route of that kind. White filled and hollow triangles together show ways that are oneway but have an exception for public transport vehicles.
Three new tests have been added with the following warning messages:
- "PT: Relation member roles do not match tags" -> if route relation members do not match the criteria for PTStops and PTWays (see the entry from the 22nd of June)
- "PT: Route should start and end with a stop_position" -> if there is no stop_position at the beginning or at the end or the route
- "PT: First or last way needs to be split" -> if the stop_position at the beginning/end of the route exists but it is not a first or last node of the way
The plugin data model two major classes are PTStop and PTWay to differentiate between route relation members that are stops and ways independently of their OsmPrimitiveType.
- The relation member role is "stop", "stop_entry_only", "stop_exit_only", "platform", "platform_entry_only" or "platform_exit_only".
- If the OsmPrimitiveType is Node, then the relation member should have tags "public_transport=stop_position", "highway=bus_stop", "public_transport=platform", "highway=platform" or "railway=platform"
- If the OsmPrimitiveType is Way, then the relation members should have tags "public_transport=platform", "highway=platform" or "railway=platform"
- If the OsmPrimitiveType is Way, this relation member cannot be a PTStop.
If a route relation has two consecutive members that belong to the same stop (a platform and a stop_position), they will be form one PTStop.
- Cannot be of OsmPrimitiveType Node
- If the OsmPrimitiveType is Way, then the relation member may not have tags "public_transport=platform", "highway=platform" or "railway=platform"
- If the OsmPrimitiveType is Relation, this nested relation is only allowed to have Ways as members.
If a route relation member does not fulfill these criteria, it is not added to the model, instead a "PT: Relation member roles do not match tags" warning appears.
A new revision of the plugin is in progress. The plugin should carry out tests in several stages and receive user input and / or route edits in between them.
At this point:
- Incomplete relations can be downloaded (user is asked to confirm)
- Direction test tests for roads tagged as oneway that are passed in the wrong direction (fix in form of way removal is available). UPD: automated fixes may remove too many ways if the route relation members are in the wrong order.
- Road type test tests for ways whose type does not match the route type (fix in form of way removal is available)
- Sorting test tests if the only problem with the route is the wrong sorting of the ways (fix in form of sorting the relation members is available)
- A "dummy warning" appears in the validator window to indicate the functionality that has not been implemented yet (but means nothing)
The plugin suggests (and carries out) automated fixes:
- if the order of stations is wrong and can be corrected by sorting only;
- if the route has overshoots, i.e. single segments that are attached to the route at one node (probably results of way splitting), they can be found and removed automatically.
The JOSM validator can test public transport routes (condition: a relation has tag "route") to check:
- whether the platforms are at the beginning of the relation member list. If they are not, a "PT: route relation(s) contain(s) way(s) before platform(s) in the members list" warning appears.
- whether there are gaps in the route. If there are, and they can be fixed by simple sorting, a "PT: Route contains a gap that can be fixed by sorting the ways" warning appears. If they cannot be fixed by simple sorting, a "PT: Route contains a gap that cannot be fixed by sorting the ways." warning appears. This is work in progress.