Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for light_rail routes #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/ptv2_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ RouteType PTv2Checker::get_route_type(const char* route) {
assert(route);
if (!strcmp(route, "train")) {
return RouteType::TRAIN;
} else if (!strcmp(route, "light_rail")) {
return RouteType::LIGHT_RAIL;
} else if (!strcmp(route, "subway")) {
return RouteType::SUBWAY;
} else if (!strcmp(route, "tram")) {
Expand Down Expand Up @@ -49,6 +51,8 @@ bool PTv2Checker::vehicle_tags_matches_route_type(const osmium::TagList& tags, R
return tags.has_tag("trolleybus", "yes");
case RouteType::TRAIN:
return tags.has_tag("train", "yes");
case RouteType::LIGHT_RAIL:
return tags.has_tag("light_rail", "yes");
case RouteType::TRAM:
return tags.has_tag("tram", "yes");
case RouteType::SUBWAY:
Expand All @@ -67,7 +71,7 @@ bool PTv2Checker::check_valid_railway_track(RouteType type, const osmium::TagLis
if (!railway) {
return is_ferry(member_tags);
}
if (type == RouteType::TRAIN || type == RouteType::TRAM) {
if (type == RouteType::TRAIN || type == RouteType::LIGHT_RAIL || 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;
Expand Down Expand Up @@ -144,6 +148,7 @@ BackOrFront PTv2Checker::roundabout_connected_to_next_way(const osmium::Way* pre
RouteError PTv2Checker::is_way_usable(const osmium::Relation& relation, RouteType type, const osmium::Way* way) {
switch (type) {
case RouteType::TRAIN:
case RouteType::LIGHT_RAIL:
case RouteType::TRAM:
case RouteType::SUBWAY:
if (!check_valid_railway_track(type, way->tags())) {
Expand Down
3 changes: 2 additions & 1 deletion src/route_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ enum class RouteType : char {
FERRY,
TRAIN,
TRAM,
SUBWAY
SUBWAY,
LIGHT_RAIL
};

/**
Expand Down