]> git.openstreetmap.org Git - rails.git/commitdiff
Add ferry routing information for OSRM
authorSimon Legner <Simon.Legner@gmail.com>
Tue, 6 Oct 2015 19:08:35 +0000 (21:08 +0200)
committerSimon Legner <Simon.Legner@gmail.com>
Tue, 6 Oct 2015 19:09:56 +0000 (21:09 +0200)
Relates to #1000.

Uses instruction code 18 to represent a ferry instruction. Ferry icon
taken from Mapbox Maki set (CC0).

app/assets/images/routing-sprite.png
app/assets/javascripts/index/directions/osrm.js
app/assets/stylesheets/common.scss

index 37d94886ddf07ea4074f92c01584394761984983..42ec7b4cdf94c3098160e40542d81ca645bc3b32 100644 (file)
Binary files a/app/assets/images/routing-sprite.png and b/app/assets/images/routing-sprite.png differ
index 4a42d5dc96ea1e8d138c353afbd28824dc7bbdba..d9ce0a6b1fe9f0e803e77495ee60104ed395bec3 100644 (file)
@@ -28,7 +28,8 @@ function OSRMEngine() {
         'javascripts.directions.instructions.start',            // 14
         'javascripts.directions.instructions.destination',      // 15
         'javascripts.directions.instructions.against_oneway',   // 16
-        'javascripts.directions.instructions.end_oneway'        // 17
+        'javascripts.directions.instructions.end_oneway',       // 17
+        'javascripts.directions.instructions.ferry'             // 18
       ];
 
       var params = [
@@ -69,6 +70,10 @@ function OSRMEngine() {
             var s = data.route_instructions[i];
             var linesegend;
             var instCodes = s[0].split('-');
+            if (s[8] === 2) {
+              /* indicates a ferry in car routing mode, see https://github.com/Project-OSRM/osrm-backend/blob/6cbbd1e5a1b441eb27055f56956e1bac14832a58/profiles/car.lua#L151 */
+              instCodes = ["18"];
+            }
             var instText = "<b>" + (i + 1) + ".</b> ";
             var name = s[1] ? "<b>" + s[1] + "</b>" : I18n.t('javascripts.directions.instructions.unnamed');
             if (instCodes[0] === "11" && instCodes[1]) {
@@ -81,7 +86,7 @@ function OSRMEngine() {
             } else {
               linesegend = s[3] + 1;
             }
-            steps.push([line[s[3]], s[0].split('-')[0], instText, s[2], line.slice(s[3], linesegend)]);
+            steps.push([line[s[3]], instCodes[0], instText, s[2], line.slice(s[3], linesegend)]);
           }
 
           callback(false, {
index 9b795aeab7aeaa36329a4bbf4fb1d1ab4e40819c..3afef70e30b82e4a110a4b8c76305cbbbd25fbcf 100644 (file)
@@ -1003,7 +1003,7 @@ div.direction {
   height: 20px;
   background-repeat: no-repeat;
 }
-@for $i from 1 through 17 {
+@for $i from 1 through 18 {
 div.direction.i#{$i} { background-position: #{($i)*-20+20}px 0px; }
 }