From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Sat, 12 Apr 2025 14:33:19 +0000 (+0200) Subject: Add OSRM ferry support X-Git-Tag: live~38^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/912abc7505847aae2e5c236a4b074f7ed46e0862?ds=sidebyside;hp=--cc Add OSRM ferry support --- 912abc7505847aae2e5c236a4b074f7ed46e0862 diff --git a/app/assets/javascripts/index/directions/fossgis_osrm.js b/app/assets/javascripts/index/directions/fossgis_osrm.js index 53043e06d..a97bc25a5 100644 --- a/app/assets/javascripts/index/directions/fossgis_osrm.js +++ b/app/assets/javascripts/index/directions/fossgis_osrm.js @@ -30,6 +30,7 @@ "rotary": "roundabout", "exit roundabout": "exit_roundabout", "exit rotary": "exit_roundabout", + "ferry": "ferry", "depart": "start", "arrive": "destination" }; @@ -81,8 +82,10 @@ } function _processDirections(leg) { - function getManeuverId(maneuver) { + function getManeuverId({ maneuver, mode, intersections }) { // special case handling + if (mode === "ferry") return "ferry"; + if (intersections.some(i => i.classes?.includes("ferry"))) return "ferry"; switch (maneuver.type) { case "on ramp": case "off ramp": @@ -129,11 +132,12 @@ "rotary": "roundabout", "exit roundabout": "roundabout", "exit rotary": "roundabout", + "ferry": "ferry", "depart": "start", "arrive": "destination" }; - for (const step of leg.steps) step.maneuverId = getManeuverId(step.maneuver); + for (const step of leg.steps) step.maneuverId = getManeuverId(step); const steps = leg.steps.map(step => [ ICON_MAP[step.maneuverId], diff --git a/config/locales/en.yml b/config/locales/en.yml index 16b967ead..c4c53f059 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3348,6 +3348,7 @@ en: roundabout_with_exit: At the roundabout take the exit %{exit} onto %{name} roundabout_with_exit_ordinal: At the roundabout take the %{exit} exit onto %{name} exit_roundabout: Exit the roundabout onto %{name} + ferry_without_exit: Take the ferry %{name} unnamed: "unnamed road" courtesy: "Directions courtesy of %{link}" exit_counts: