Skip to content

Commit

Permalink
fix relation tags preference
Browse files Browse the repository at this point in the history
  • Loading branch information
takb committed Mar 1, 2023
1 parent 43dcfcb commit 6365e8d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public enum RouteNetwork {

MISSING("missing"), INTERNATIONAL("international"), NATIONAL("national"), REGIONAL("regional"),
LOCAL("local"), FERRY("ferry"), DEPRECATED("deprecated"), MTB("mtb"), OTHER("other");
LOCAL("local"), MTB("mtb"), FERRY("ferry"), DEPRECATED("deprecated"), OTHER("other");

public static String key(String prefix) {
return prefix + "_network";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public IntsRef handleRelationTags(IntsRef relFlags, ReaderRelation relation) {
newBikeNetwork = RouteNetwork.NATIONAL;
} else if ("icn".equals(tag)) {
newBikeNetwork = RouteNetwork.INTERNATIONAL;
} else if ("mtb".equals(tag)) {
newBikeNetwork = RouteNetwork.MTB;
} else if ("deprecated".equals(tag)) {
newBikeNetwork = RouteNetwork.DEPRECATED;
} else {
Expand All @@ -61,9 +63,9 @@ public IntsRef handleRelationTags(IntsRef relFlags, ReaderRelation relation) {
newBikeNetwork = RouteNetwork.FERRY;
}
if (relation.hasTag("route", "mtb")) { // for MTB profile
newBikeNetwork = RouteNetwork.MTB;
newBikeNetwork = RouteNetwork.OTHER;
}
if (oldBikeNetwork == RouteNetwork.MISSING || oldBikeNetwork.ordinal() > newBikeNetwork.ordinal())
if (newBikeNetwork != RouteNetwork.MISSING && (oldBikeNetwork == RouteNetwork.MISSING || oldBikeNetwork.ordinal() > newBikeNetwork.ordinal()))
transformerRouteRelEnc.setEnum(false, relFlags, newBikeNetwork);
return relFlags;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public IntsRef handleRelationTags(IntsRef relFlags, ReaderRelation relation) {
if (relation.hasTag("route", "bicycle") || relation.hasTag("route", "inline_skates")) { // for wheelchair profile
newFootNetwork = RouteNetwork.OTHER;
}
if (oldFootNetwork == RouteNetwork.MISSING || oldFootNetwork.ordinal() > newFootNetwork.ordinal())
if (newFootNetwork != RouteNetwork.MISSING && (oldFootNetwork == RouteNetwork.MISSING || oldFootNetwork.ordinal() > newFootNetwork.ordinal()))
transformerRouteRelEnc.setEnum(false, relFlags, newFootNetwork);
return relFlags;
}
Expand Down

0 comments on commit 6365e8d

Please sign in to comment.