]> git.openstreetmap.org Git - rails.git/commitdiff
Include car profile for GraphHopper routing
authorPeter Karich <graphhopper@gmx.de>
Mon, 22 May 2017 20:20:09 +0000 (22:20 +0200)
committerTom Hughes <tom@compton.nu>
Wed, 24 May 2017 20:17:22 +0000 (21:17 +0100)
Closes #1547

app/assets/javascripts/index/directions/graphhopper.js

index 4bb4e4ed6bc160870d50c4ae1e1845c04f42529c..2058a4daf4437bf13955f2d4abefcb4406bdb436 100644 (file)
@@ -14,18 +14,19 @@ function GraphHopperEngine(id, vehicleType) {
 
   return {
     id: id,
-    creditline: '<a href="https://graphhopper.com/" target="_blank">Graphhopper</a>',
+    creditline: '<a href="https://www.graphhopper.com/" target="_blank">Graphhopper</a>',
     draggable: false,
 
     getRoute: function (points, callback) {
       // GraphHopper Directions API documentation
-      // https://github.com/graphhopper/directions-api/blob/master/docs-routing.md
+      // https://graphhopper.com/api/1/docs/routing/
       return $.ajax({
         url: document.location.protocol + OSM.GRAPHHOPPER_URL,
         data: {
           vehicle: vehicleType,
           locale: I18n.currentLocale(),
           key: "LijBPDQGfu7Iiq80w3HzwB4RUDJbMbhs6BU0dEnn",
+          "ch.disable": vehicleType === "car",
           type: "jsonp",
           elevation: false,
           instructions: true,
@@ -79,5 +80,6 @@ function GraphHopperEngine(id, vehicleType) {
   };
 }
 
+OSM.Directions.addEngine(new GraphHopperEngine("graphhopper_car", "car"), true);
 OSM.Directions.addEngine(new GraphHopperEngine("graphhopper_bicycle", "bike"), true);
 OSM.Directions.addEngine(new GraphHopperEngine("graphhopper_foot", "foot"), true);