]> git.openstreetmap.org Git - rails.git/commitdiff
Add OSRM ferry support
authorMarwin Hochfelsner <50826859+hlfan@users.noreply.github.com>
Sat, 12 Apr 2025 14:33:19 +0000 (16:33 +0200)
committerMarwin Hochfelsner <50826859+hlfan@users.noreply.github.com>
Sun, 13 Apr 2025 09:52:36 +0000 (11:52 +0200)
app/assets/javascripts/index/directions/fossgis_osrm.js
config/locales/en.yml

index 53043e06d35366df94da0505c333360f68d6bdf4..a97bc25a5e78d1ea8b5d9c12f5a5c369e38dc345 100644 (file)
@@ -30,6 +30,7 @@
         "rotary": "roundabout",
         "exit roundabout": "exit_roundabout",
         "exit rotary": "exit_roundabout",
+        "ferry": "ferry",
         "depart": "start",
         "arrive": "destination"
       };
     }
 
     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":
         "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],
index 16b967ead238558d2e84b69e0462f1c392b6e8b2..c4c53f05906f8fa93b80234717e8cf62e3da70ff 100644 (file)
@@ -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: