Modify

Opened 5 years ago

Last modified 2 years ago

#15415 new defect

PT_assistant: remove warning about gap if route contains only one way

Reported by: bxl-forever Owned by: darya
Priority: normal Milestone:
Component: Plugin pt_assistant Version: latest
Keywords: template_report validator gap Cc: michael2402, floscher, Polyglot

Description

What steps will reproduce the problem?

  1. Have the PT_assistant plugin
  2. Create a public transport route relation (type=route, public_transport:version=2, route=bus), containing some stops but only *one* way
  3. Attempt to upload

What is the expected result?

Validation without any warning.

What happens instead?

PT assistant triggers warning: "Route relation contains a gap".

Please provide any additional information below. Attach a screenshot if possible.

The warning does not appear if one splits the way—proving that it is really linked to the fact that there is only one way in the relation.
Despite it may look silly to have only one way in a public transport route relation, sometime we have this for very short relations such as turnaround maneuvers at terminal stations and so on, or for cases where ways are long enough to cover the whole route (like in railways or trams). Solving the code upstream makes more sense than imposing to split ways in OSM.

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2017-10-03 21:43:00 +0200 (Tue, 03 Oct 2017)
Build-Date:2017-10-03 19:50:21
Revision:12921
Relative:URL: ^/trunk

Identification: JOSM/1.5 (12921 en) Linux Arch Linux
Java version: 1.8.0_144-b01, Oracle Corporation, OpenJDK 64-Bit Server VM
VM arguments: [-Djosm.restart=true]
Dataset consistency test: No problems found

Plugins:
+ log4j (32699)
+ measurement (33088)
+ pt_assistant (33619)
+ routing (33004)

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by francians

Hello,

I had the same problem... I think the problem is in file:

src/org/openstreetmap/josm/data/validation/tests/PublicTransportRouteTest.java

check this hunk

        for (int i = 0; i < links.size(); i++) {
            final WayConnectionType link = links.get(i);
            final boolean hasError = !(i == 0 || link.linkPrev)
                    || !(i == links.size() - 1 || link.linkNext)
                    || link.direction == null
                    || WayConnectionType.Direction.NONE == link.direction;
            if (hasError) {
                errors.add(TestError.builder(this, Severity.WARNING, 3602)
                        .message(tr("Route relation contains a gap"))
                        .primitives(r)
                        .build());
                return;
            }
        }

probably (haven't really debugged) link.direction will be null if you have only one segment... I'd simply skip it when you don't have at least 2 links:

    if (links.size() > 1) {
        for (int i = 0; i < links.size(); i++) {
            final WayConnectionType link = links.get(i);
            final boolean hasError = !(i == 0 || link.linkPrev)
                    || !(i == links.size() - 1 || link.linkNext)
                    || link.direction == null
                    || WayConnectionType.Direction.NONE == link.direction;
            if (hasError) {
                errors.add(TestError.builder(this, Severity.WARNING, 3602)
                        .message(tr("Route relation contains a gap"))
                        .primitives(r)
                        .build());
                return;
            }
        }
    }

cheers
Francesco

comment:2 Changed 2 years ago by skyper

Cc: michael2402 floscher Polyglot added
Keywords: validator gap added

Get this false-positive for almost every aerialway route relation.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain darya.
as The resolution will be set.
to The owner will be changed from darya to the specified user.
The owner will change to bxl-forever
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from darya to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.