]> git.openstreetmap.org Git - rails.git/commitdiff
Remove dependencies on mapzen services
authorTom Hughes <tom@compton.nu>
Tue, 2 Jan 2018 18:45:20 +0000 (18:45 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 2 Jan 2018 18:45:20 +0000 (18:45 +0000)
app/assets/javascripts/index/directions/mapzen.js [deleted file]
app/assets/javascripts/osm.js.erb
app/controllers/application_controller.rb
app/views/site/export.html.erb
config/example.application.yml
config/locales/en.yml

diff --git a/app/assets/javascripts/index/directions/mapzen.js b/app/assets/javascripts/index/directions/mapzen.js
deleted file mode 100644 (file)
index 981fc38..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-function MapzenEngine(id, costing) {
-  var MZ_INSTR_MAP = [
-    0,  // kNone = 0;
-    8, // kStart = 1;
-    8, // kStartRight = 2;
-    8, // kStartLeft = 3;
-    14,  // kDestination = 4;
-    14,  // kDestinationRight = 5;
-    14,  // kDestinationLeft = 6;
-    0,  // kBecomes = 7;
-    0,  // kContinue = 8;
-    1,  // kSlightRight = 9;
-    2,  // kRight = 10;
-    3,  // kSharpRight = 11;
-    4,  // kUturnRight = 12;
-    4,  // kUturnLeft = 13;
-    7,  // kSharpLeft = 14;
-    6,  // kLeft = 15;
-    5,  // kSlightLeft = 16;
-    0,  // kRampStraight = 17;
-    24, // kRampRight = 18;
-    25, // kRampLeft = 19;
-    24, // kExitRight = 20;
-    25, // kExitLeft = 21;
-    0,  // kStayStraight = 22;
-    1,  // kStayRight = 23;
-    5,  // kStayLeft = 24;
-    20, // kMerge = 25;
-    10, // kRoundaboutEnter = 26;
-    11, // kRoundaboutExit = 27;
-    17, // kFerryEnter = 28;
-    0   // kFerryExit = 29;
-  ];
-
-  return {
-    id: id,
-    creditline: "<a href='https://mapzen.com/products/turn-by-turn/' target='_blank'>Mapzen</a>",
-    draggable: false,
-
-    getRoute: function (points, callback) {
-      return $.ajax({
-        url: document.location.protocol + OSM.MAPZEN_VALHALLA_URL,
-        data: {
-          api_key: OSM.MAPZEN_VALHALLA_KEY,
-          json: JSON.stringify({
-            locations: points.map(function (p) { return { lat: p.lat, lon: p.lng }; }),
-            costing: costing,
-            directions_options: {
-              units: "km",
-              language: I18n.currentLocale()
-            }
-          })
-        },
-        dataType: "json",
-        success: function (data) {
-          var trip = data.trip;
-
-          if (trip.status === 0) {
-            var line = [];
-            var steps = [];
-            var distance = 0;
-            var time = 0;
-
-            trip.legs.forEach(function (leg) {
-              var legLine = L.PolylineUtil.decode(leg.shape, {
-                precision: 6
-              });
-
-              line = line.concat(legLine);
-
-              leg.maneuvers.forEach(function (manoeuvre) {
-                var point = legLine[manoeuvre.begin_shape_index];
-
-                steps.push([
-                  { lat: point[0], lng: point[1] },
-                  MZ_INSTR_MAP[manoeuvre.type],
-                  manoeuvre.instruction,
-                  manoeuvre.length * 1000,
-                  []
-                ]);
-              });
-
-              distance = distance + leg.summary.length;
-              time = time + leg.summary.time;
-            });
-
-            callback(false, {
-              line: line,
-              steps: steps,
-              distance: distance * 1000,
-              time: time
-            });
-          } else {
-            callback(true);
-          }
-        },
-        error: function () {
-          callback(true);
-        }
-      });
-    }
-  };
-}
-
-if (OSM.MAPZEN_VALHALLA_KEY) {
-  OSM.Directions.addEngine(new MapzenEngine("mapzen_car", "auto"), true);
-  OSM.Directions.addEngine(new MapzenEngine("mapzen_bicycle", "bicycle"), true);
-  OSM.Directions.addEngine(new MapzenEngine("mapzen_foot", "pedestrian"), true);
-}
index ee1c6a115e427a299e9735c4846c98ea187ccf42..971f80be3354136f7fb90cb260253e5780c968f6 100644 (file)
@@ -14,16 +14,12 @@ OSM = {
   NOMINATIM_URL:           <%= NOMINATIM_URL.to_json %>,
   GRAPHHOPPER_URL:         <%= GRAPHHOPPER_URL.to_json %>,
   MAPQUEST_DIRECTIONS_URL: <%= MAPQUEST_DIRECTIONS_URL.to_json %>,
-  MAPZEN_VALHALLA_URL:     <%= MAPZEN_VALHALLA_URL.to_json %>,
   OSRM_URL:                <%= OSRM_URL.to_json %>,
   DEFAULT_LOCALE:          <%= I18n.default_locale.to_json %>,
 
 <% if defined?(MAPQUEST_KEY) %>
   MAPQUEST_KEY:            <%= MAPQUEST_KEY.to_json %>,
 <% end %>
-<% if defined?(MAPZEN_VALHALLA_KEY) %>
-  MAPZEN_VALHALLA_KEY:     <%= MAPZEN_VALHALLA_KEY.to_json %>,
-<% end %>
 <% if defined?(THUNDERFOREST_KEY) %>
   THUNDERFOREST_KEY:       <%= THUNDERFOREST_KEY.to_json %>,
 <% end %>
index db5d086ecbf088c06c7e4f850299329ee8be1068..9d1338ab5741fedac275827427294587176bb31b 100644 (file)
@@ -414,7 +414,7 @@ class ApplicationController < ActionController::Base
   def map_layout
     append_content_security_policy_directives(
       :child_src => %w[127.0.0.1:8111 127.0.0.1:8112],
-      :connect_src => %w[nominatim.openstreetmap.org overpass-api.de router.project-osrm.org valhalla.mapzen.com],
+      :connect_src => %w[nominatim.openstreetmap.org overpass-api.de router.project-osrm.org],
       :form_action => %w[render.openstreetmap.org],
       :script_src => %w[graphhopper.com open.mapquestapi.com],
       :img_src => %w[developer.mapquest.com]
index 128db59928e8c1ae67af6dbf387fa840d4b0f5ad..52ecbf5135cf2359269cbeea242a387341a7796b 100644 (file)
@@ -47,9 +47,6 @@
     <dt><a href="http://download.geofabrik.de/"><%= t'export.start.too_large.geofabrik.title' %></a></dt>
     <dd><%= t'export.start.too_large.geofabrik.description' %></dd>
 
-    <dt><a href="https://mapzen.com/data/metro-extracts/"><%= t'export.start.too_large.metro.title' %></a></dt>
-    <dd><%= t'export.start.too_large.metro.description' %></dd>
-
     <dt><a href="http://wiki.openstreetmap.org/wiki/Download"><%= t'export.start.too_large.other.title' %></a></dt>
     <dd><%= t'export.start.too_large.other.description' %></dd>
   </dl>
index 5c60ccd16b4f9e6042896f5e222822c7df3a2349..26431f4742fef38d6e63d674432809d322378fd2 100644 (file)
@@ -101,7 +101,6 @@ defaults: &defaults
   # Routing endpoints
   graphhopper_url: "//graphhopper.com/api/1/route"
   mapquest_directions_url: "//open.mapquestapi.com/directions/v2/route"
-  mapzen_valhalla_url: "//valhalla.mapzen.com/route"
   osrm_url: "//router.project-osrm.org/route/v1/driving/"
   # External authentication credentials
   #google_auth_id: ""
@@ -117,8 +116,6 @@ defaults: &defaults
   #wikipedia_auth_secret: ""
   # MapQuest authentication details
   #mapquest_key: ""
-  # Mapzen authentication details
-  #mapzen_valhalla_key: ""
   # Thunderforest authentication details
   #thunderforest_key: ""
   # Key for generating TOTP tokens
index 317dee88ea66b668b10e5510126da7bf5beb871d..0347372bb7c5392bf803cbe20e05b892d167bdd0 100644 (file)
@@ -2262,9 +2262,6 @@ en:
         mapquest_car: "Car (MapQuest)"
         mapquest_foot: "Foot (MapQuest)"
         osrm_car: "Car (OSRM)"
-        mapzen_bicycle: "Bicycle (Mapzen)"
-        mapzen_car: "Car (Mapzen)"
-        mapzen_foot: "Foot (Mapzen)"
       descend: "Descend"
       directions: "Directions"
       distance: "Distance"