]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions/graphhopper.js
Convert various URLs to https
[rails.git] / app / assets / javascripts / index / directions / graphhopper.js
index 4bb4e4ed6bc160870d50c4ae1e1845c04f42529c..f05f1ab3dfb761336a471ce49f542edd4965af60 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,
+        url: 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);