]> git.openstreetmap.org Git - rails.git/commitdiff
Remove old MapQuest Directions routing support
authorSimon Poole <simonpoole@users.noreply.github.com>
Tue, 29 Jan 2019 19:03:30 +0000 (19:03 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 29 Jan 2019 20:19:36 +0000 (20:19 +0000)
app/assets/javascripts/index/directions/mapquest.js [deleted file]
app/assets/javascripts/osm.js.erb
app/controllers/application_controller.rb
config/example.application.yml
config/locales/en.yml

diff --git a/app/assets/javascripts/index/directions/mapquest.js b/app/assets/javascripts/index/directions/mapquest.js
deleted file mode 100644 (file)
index 739ce65..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-// For docs, see:
-// https://developer.mapquest.com/web/products/open/directions-service
-// https://open.mapquestapi.com/directions/
-// https://github.com/apmon/openstreetmap-website/blob/21edc353a4558006f0ce23f5ec3930be6a7d4c8b/app/controllers/routing_controller.rb#L153
-
-function MapQuestEngine(id, routeType) {
-  var MQ_SPRITE_MAP = {
-    0: 0, // straight
-    1: 1, // slight right
-    2: 2, // right
-    3: 3, // sharp right
-    4: 4, // reverse
-    5: 7, // sharp left
-    6: 6, // left
-    7: 5, // slight left
-    8: 4, // right U-turn
-    9: 4, // left U-turn
-    10: 21, // right merge
-    11: 20, // left merge
-    12: 21, // right on-ramp
-    13: 20, // left on-ramp
-    14: 24, // right off-ramp
-    15: 25, // left off-ramp
-    16: 18, // right fork
-    17: 19, // left fork
-    18: 0  // straight fork
-  };
-
-  return {
-    id: id,
-    creditline: '<a href="https://www.mapquest.com/" target="_blank">MapQuest</a> <img src="' + document.location.protocol + '//developer.mapquest.com/content/osm/mq_logo.png">',
-    draggable: false,
-
-    getRoute: function (points, callback) {
-      var from = points[0];
-      var to = points[points.length - 1];
-
-      return $.ajax({
-        url: OSM.MAPQUEST_DIRECTIONS_URL,
-        data: {
-          key: OSM.MAPQUEST_KEY,
-          from: from.lat + "," + from.lng,
-          to: to.lat + "," + to.lng,
-          routeType: routeType,
-          // locale: I18n.currentLocale(), //Doesn't actually work. MapQuest requires full locale e.g. "de_DE", but I18n may only provides language, e.g. "de"
-          manMaps: false,
-          shapeFormat: "raw",
-          generalize: 0,
-          unit: "k"
-        },
-        dataType: "jsonp",
-        success: function (data) {
-          if (data.info.statuscode !== 0)
-            return callback(true);
-
-          var i;
-          var line = [];
-          var shape = data.route.shape.shapePoints;
-          for (i = 0; i < shape.length; i += 2) {
-            line.push(L.latLng(shape[i], shape[i + 1]));
-          }
-
-          // data.route.shape.maneuverIndexes links turns to polyline positions
-          // data.route.legs[0].maneuvers is list of turns
-          var steps = [];
-          var mq = data.route.legs[0].maneuvers;
-          for (i = 0; i < mq.length; i++) {
-            var s = mq[i];
-            var d;
-            var linesegstart, linesegend, lineseg;
-            linesegstart = data.route.shape.maneuverIndexes[i];
-            if (i === mq.length - 1) {
-              d = 15;
-              linesegend = linesegstart + 1;
-            } else {
-              d = MQ_SPRITE_MAP[s.turnType];
-              linesegend = data.route.shape.maneuverIndexes[i + 1] + 1;
-            }
-            lineseg = [];
-            for (var j = linesegstart; j < linesegend; j++) {
-              lineseg.push(L.latLng(data.route.shape.shapePoints[j * 2], data.route.shape.shapePoints[j * 2 + 1]));
-            }
-            steps.push([L.latLng(s.startPoint.lat, s.startPoint.lng), d, s.narrative, s.distance * 1000, lineseg]);
-          }
-
-          callback(false, {
-            line: line,
-            steps: steps,
-            distance: data.route.distance * 1000,
-            time: data.route.time
-          });
-        },
-        error: function () {
-          callback(true);
-        }
-      });
-    }
-  };
-}
-
-if (OSM.MAPQUEST_KEY) {
-  OSM.Directions.addEngine(new MapQuestEngine("mapquest_bicycle", "bicycle"), true);
-  OSM.Directions.addEngine(new MapQuestEngine("mapquest_foot", "pedestrian"), true);
-  OSM.Directions.addEngine(new MapQuestEngine("mapquest_car", "fastest"), true);
-}
index 7e7e6a5fa86d62ac3a87f79d951a3b9dfe18fee5..a9e1a475ec15d8daf302e4cc9faeb2355adb3859 100644 (file)
@@ -14,13 +14,9 @@ OSM = {
   OVERPASS_URL:            <%= OVERPASS_URL.to_json %>,
   NOMINATIM_URL:           <%= NOMINATIM_URL.to_json %>,
   GRAPHHOPPER_URL:         <%= GRAPHHOPPER_URL.to_json %>,
   OVERPASS_URL:            <%= OVERPASS_URL.to_json %>,
   NOMINATIM_URL:           <%= NOMINATIM_URL.to_json %>,
   GRAPHHOPPER_URL:         <%= GRAPHHOPPER_URL.to_json %>,
-  MAPQUEST_DIRECTIONS_URL: <%= MAPQUEST_DIRECTIONS_URL.to_json %>,
   FOSSGIS_OSRM_URL:        <%= FOSSGIS_OSRM_URL.to_json %>,
   DEFAULT_LOCALE:          <%= I18n.default_locale.to_json %>,
 
   FOSSGIS_OSRM_URL:        <%= FOSSGIS_OSRM_URL.to_json %>,
   DEFAULT_LOCALE:          <%= I18n.default_locale.to_json %>,
 
-<% if defined?(MAPQUEST_KEY) %>
-  MAPQUEST_KEY:            <%= MAPQUEST_KEY.to_json %>,
-<% end %>
 <% if defined?(THUNDERFOREST_KEY) %>
   THUNDERFOREST_KEY:       <%= THUNDERFOREST_KEY.to_json %>,
 <% end %>
 <% if defined?(THUNDERFOREST_KEY) %>
   THUNDERFOREST_KEY:       <%= THUNDERFOREST_KEY.to_json %>,
 <% end %>
index 71d5e82316423b04030e354405518e5603ae0fd5..9666adf129698f8fc690c61c33aec247623e7acb 100644 (file)
@@ -335,9 +335,7 @@ class ApplicationController < ActionController::Base
       :frame_src => %w[http://127.0.0.1:8111 https://127.0.0.1:8112],
       :connect_src => [NOMINATIM_URL, OVERPASS_URL, FOSSGIS_OSRM_URL, GRAPHHOPPER_URL],
       :form_action => %w[render.openstreetmap.org],
       :frame_src => %w[http://127.0.0.1:8111 https://127.0.0.1:8112],
       :connect_src => [NOMINATIM_URL, OVERPASS_URL, FOSSGIS_OSRM_URL, GRAPHHOPPER_URL],
       :form_action => %w[render.openstreetmap.org],
-      :style_src => %w['unsafe-inline'],
-      :script_src => [MAPQUEST_DIRECTIONS_URL],
-      :img_src => %w[developer.mapquest.com]
+      :style_src => %w['unsafe-inline']
     )
 
     if STATUS == :database_offline || STATUS == :api_offline
     )
 
     if STATUS == :database_offline || STATUS == :api_offline
index fc9b795db43b4c81706cf12b718094349c253a9a..7db7861b2dfe8acf84f47fdeb8d7ca5c4b441f4c 100644 (file)
@@ -104,7 +104,6 @@ defaults: &defaults
   overpass_url: "https://overpass-api.de/api/interpreter"
   # Routing endpoints
   graphhopper_url: "https://graphhopper.com/api/1/route"
   overpass_url: "https://overpass-api.de/api/interpreter"
   # Routing endpoints
   graphhopper_url: "https://graphhopper.com/api/1/route"
-  mapquest_directions_url: "https://open.mapquestapi.com/directions/v2/route"
   fossgis_osrm_url: "https://routing.openstreetmap.de/"
   # External authentication credentials
   #google_auth_id: ""
   fossgis_osrm_url: "https://routing.openstreetmap.de/"
   # External authentication credentials
   #google_auth_id: ""
@@ -118,8 +117,6 @@ defaults: &defaults
   #github_auth_secret: ""
   #wikipedia_auth_id: ""
   #wikipedia_auth_secret: ""
   #github_auth_secret: ""
   #wikipedia_auth_id: ""
   #wikipedia_auth_secret: ""
-  # MapQuest authentication details
-  #mapquest_key: ""
   # Thunderforest authentication details
   #thunderforest_key: ""
   # Key for generating TOTP tokens
   # Thunderforest authentication details
   #thunderforest_key: ""
   # Key for generating TOTP tokens
index 958f109b9fc089dd2379030be90a8144f867f8c6..a81172de2269096fc8d0efc201ae660b6fe339f5 100644 (file)
@@ -2444,9 +2444,6 @@ en:
         graphhopper_bicycle: "Bicycle (GraphHopper)"
         graphhopper_car: "Car (GraphHopper)"
         graphhopper_foot: "Foot (GraphHopper)"
         graphhopper_bicycle: "Bicycle (GraphHopper)"
         graphhopper_car: "Car (GraphHopper)"
         graphhopper_foot: "Foot (GraphHopper)"
-        mapquest_bicycle: "Bicycle (MapQuest)"
-        mapquest_car: "Car (MapQuest)"
-        mapquest_foot: "Foot (MapQuest)"
       descend: "Descend"
       directions: "Directions"
       distance: "Distance"
       descend: "Descend"
       directions: "Directions"
       distance: "Distance"