Modify

Opened 3 years ago

Last modified 3 years ago

#16828 new enhancement

Validator does not catch PT2 relations routing along highway=construction

Reported by: pangoSE Owned by: Biswesh
Priority: normal Milestone:
Component: Plugin pt_assistant Version:
Keywords: road route Cc: Polyglot

Description (last modified by Don-vip)

OSMI catches this see example below:

layer: ptv2_error_ways
rel_id: 3307051
way_id: 32463486
node_id: 0
error: road vehicle route over non-road
from:
to:
via:
ref: 25
name: Buss 25: Stadsparken => Ankaret
route: bus

https://tools.geofabrik.de/osmi/?view=pubtrans_routes&lon=17.93658&lat=62.63245&zoom=14&overlays=ptv2_routes_invalid,ptv2_error_,ptv2_error_ways,ptv2_error_nodes


Attachments (1)

16828.PNG (142.4 KB) - added by Don-vip 3 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 3 years ago by Don-vip

Type: defectenhancement

Changed 3 years ago by Don-vip

Attachment: 16828.PNG added

comment:2 Changed 3 years ago by Don-vip

Description: modified (diff)
Keywords: road route added

comment:3 Changed 3 years ago by Don-vip

OSMI source code:

RouteError PTv2Checker::is_way_usable(const osmium::Relation& relation, RouteType type, const osmium::Way* way) {
    switch (type) {
    case RouteType::TRAIN:
    case RouteType::TRAM:
    case RouteType::SUBWAY:
        if (!check_valid_railway_track(type, way->tags())) {
            m_writer.write_error_way(relation, 0, "rail-guided route over non-rail", way);
            return RouteError::OVER_NON_RAIL;
        }
        break;

    case RouteType::BUS:
        if (!check_valid_road_way(way->tags())) {
            m_writer.write_error_way(relation, 0, "road vehicle route over non-road", way);
            return RouteError::OVER_NON_ROAD;
        }
        break;
    case RouteType::TROLLEYBUS:
        if (!check_valid_trolleybus_way(way->tags())) {
            m_writer.write_error_way(relation, 0, "trolley bus without trolley wire", way);
            return RouteError::NO_TROLLEY_WIRE;
        }
        break;
    case RouteType::FERRY:
        if (!is_ferry(way->tags(), true)) {
            m_writer.write_error_way(relation, 0, "trolley bus without trolley wire", way);
            return RouteError::NO_FERRY;
        }
        break;
    default:
        return RouteError::CLEAN;
    }
    return RouteError::CLEAN;
}

bool PTv2Checker::check_valid_railway_track(RouteType type, const osmium::TagList& member_tags) {
    const char* railway = member_tags.get_value_by_key("railway");
    if (!railway) {
        return is_ferry(member_tags);
    }
    if (type == RouteType::TRAIN || type == RouteType::TRAM) {
        if (!strcmp(railway, "rail") || !strcmp(railway, "light_rail") || !strcmp(railway, "tram") || !strcmp(railway, "subway")
                || !strcmp(railway, "funicular") || !strcmp(railway, "preserved") || !strcmp(railway, "miniature") || !strcmp(railway, "narrow_gauge")) {
            return true;
        }
    }
    if (type == RouteType::SUBWAY) {
            return true;
    }
    return is_ferry(member_tags);
}

bool PTv2Checker::check_valid_road_way(const osmium::TagList& member_tags) {
    const char* highway = member_tags.get_value_by_key("highway");
    if (!highway) {
        return is_ferry(member_tags);
    }
    return (!strcmp(highway, "motorway") || !strcmp(highway, "motorway_link") || !strcmp(highway, "trunk")
        || !strcmp(highway, "trunk_link") || !strcmp(highway, "primary") || !strcmp(highway, "primary_link")
        || !strcmp(highway, "secondary") || !strcmp(highway, "secondary_link") || !strcmp(highway, "tertiary")
        || !strcmp(highway, "tertiary_link") || !strcmp(highway, "unclassified") || !strcmp(highway, "residential")
        || !strcmp(highway, "service") || !strcmp(highway, "track") || !strcmp(highway, "pedestrian")
        || !strcmp(highway, "living_street"));
}

bool PTv2Checker::check_valid_trolleybus_way(const osmium::TagList& member_tags) {
    if (member_tags.has_tag("trolley_wire", "yes")) {
        return check_valid_road_way(member_tags);
    }
    //TODO check direction (forward wire but using the way in opposite direction might cause problems ;-)
    if (member_tags.has_tag("trolley_wire:forward", "yes") || member_tags.has_tag("trolley_wire", "forward")) {
        return check_valid_road_way(member_tags);
    }
    return (member_tags.has_tag("trolley_wire:backward", "yes") || member_tags.has_tag("trolley_wire", "backward"))
            && check_valid_road_way(member_tags);
}

bool PTv2Checker::is_ferry(const osmium::TagList& member_tags, bool permit_untagged_ways /* = false */) {
    const char* route = member_tags.get_value_by_key("route");
    return (route && !strcmp(route, "ferry")) || (permit_untagged_ways && !route);
}

comment:4 Changed 3 years ago by Don-vip

It might be already provided by pt_assistant plugin, osmwiki:JOSM/Plugins/PT_Assistant

comment:5 Changed 3 years ago by Don-vip

Component: Core validatorPlugin pt_assistant
Owner: changed from team to Biswesh

Doesn't work, but it's clearly in plugin scope.

comment:6 Changed 3 years ago by pangoSE

I had it installed when i reported.
I would like it in the core validator so people are warned on upload after unintentionally breaking PT relations. (there are a LOT of broken PT relations worldwide ATM)

comment:7 Changed 3 years ago by Don-vip

Cc: Polyglot added

We won't add some PTv2 checks in core while there is an actively developed plugin with many checks dedicated to that. Maybe later the plugin will be included to core, but it must be stabilized/cleaned up first.

If you want to help on this topic, please make contact with Polyglot.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Biswesh.
as The resolution will be set.
to The owner will be changed from Biswesh to the specified user.
The owner will change to pangoSE
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 Biswesh to anonymous.

Add Comment


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

 
Note: See TracTickets for help on using tickets.