Updated JavaScript files to use new mapquest api after the old one wasn't supported unexpectedly.

This commit is contained in:
Kasper D. Fischer 2017-12-03 11:22:37 +00:00
parent 703834c9da
commit aed22c7567
Notes: subgit 2018-03-07 17:59:13 +01:00
r871 www/trunk
3 changed files with 26 additions and 12 deletions

View File

@ -39,7 +39,9 @@
<script type="text/javascript" src="external/leaflet.label.js"></script> <script type="text/javascript" src="external/leaflet.label.js"></script>
<script src="external/jQuery.print.js"></script> <script src="external/jQuery.print.js"></script>
<script src="external/leaflet.easyPrint.js"></script> <script src="external/leaflet.easyPrint.js"></script>
<script src="https://open.mapquestapi.com/sdk/leaflet/v2.2/mq-map.js?key=RPOPuz3lA2GGBtVpEU0ugxtVoGba53Dt"></script>
<!-- <script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-map.js?key=RPOPuz3lA2GGBtVpEU0ugxtVoGba53Dt"></script> -->
<!-- Map, Events & Stations --> <!-- Map, Events & Stations -->
<script type="text/javascript" src="misc.js"></script> <script type="text/javascript" src="misc.js"></script>
<script type="text/javascript" src="geolocation.js"></script> <script type="text/javascript" src="geolocation.js"></script>

View File

@ -133,19 +133,18 @@ function initMapLink() {
$(document).ready(function() { $(document).ready(function() {
// create a map in the "map" div, set the view to a given place and zoom // create a map in the "map" div, set the view to a given place and zoom
map = L.map('map', { zoomControl: false, worldCopyJump: true }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
new L.Control.Zoom({ position: 'topright' }).addTo(map);
new L.control.scale({position: 'bottomright', imperial: false}).addTo(map);
// create baselayer // create baselayer
switch ( config['map']['baselayer'] ) { switch ( config['map']['baselayer'] ) {
case 'osmde': // add OpenStreetMap.DE tile layer case 'osmde': // add OpenStreetMap.DE tile layer
map = L.map('map', { zoomControl: false, worldCopyJump: true }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
L.tileLayer('http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', L.tileLayer('http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
{ {
attribution: '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>', attribution: '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
}).addTo(map); }).addTo(map);
break; break;
case 'esrigray': // add ESRI Grayscale World Map (neither city nor road names) case 'esrigray': // add ESRI Grayscale World Map (neither city nor road names)
map = L.map('map', { zoomControl: false, worldCopyJump: true }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
L.tileLayer('//server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', L.tileLayer('//server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',
{ {
attribution: 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ', attribution: 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ',
@ -153,18 +152,21 @@ $(document).ready(function() {
}).addTo(map); }).addTo(map);
break; break;
case 'aerial': // add ESRI WordImagery tile layer case 'aerial': // add ESRI WordImagery tile layer
map = L.map('map', { zoomControl: false, worldCopyJump: true }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
{ {
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
}).addTo(map); }).addTo(map);
break; break;
case 'komoot': // add OpenStreetMap.DE tile layer case 'komoot': // add OpenStreetMap.DE tile layer
map = L.map('map', { zoomControl: false, worldCopyJump: true }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
L.tileLayer('//www.komoot.de/tiles/{s}/{z}/{x}/{y}.png', L.tileLayer('//www.komoot.de/tiles/{s}/{z}/{x}/{y}.png',
{ {
attribution: 'Map data &copy; <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a> | Tiles Courtesy of <a href="http://www.komoot.de/">Komoot</a>', attribution: 'Map data &copy; <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a> | Tiles Courtesy of <a href="http://www.komoot.de/">Komoot</a>',
}).addTo(map); }).addTo(map);
break; break;
case 'mapquestgray': // add MapQuestOSM tile layer case 'mapquestgray': // add MapQuestOSM tile layer
map = L.map('map', { zoomControl: false, worldCopyJump: true }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
L.tileLayer.grayscale('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg', L.tileLayer.grayscale('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg',
{ {
subdomains: '1234', subdomains: '1234',
@ -175,14 +177,24 @@ $(document).ready(function() {
case 'mapquest': // add MapQuestOSM tile layer case 'mapquest': // add MapQuestOSM tile layer
null; null;
default: default:
L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg', var mapLayer = MQ.mapLayer();
{ map = L.map('map', {
subdomains: '1234', zoomControl: false,
detectRetina: true, worldCopyJump: true,
attribution: 'Map data &copy; <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a> | Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> <img src="https://developer.mapquest.com/content/osm/mq_logo.png">', layers: mapLayer,
}).addTo(map); }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
//L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg',
//{
//subdomains: '1234',
//detectRetina: true,
//attribution: 'Map data &copy; <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a> | Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> <img src="https://developer.mapquest.com/content/osm/mq_logo.png">',
//}).addTo(map);
}; };
// add controls
new L.Control.Zoom({ position: 'topright' }).addTo(map);
new L.control.scale({position: 'bottomright', imperial: false}).addTo(map);
// create station and event layer // create station and event layer
// stationLayer = L.geoJson().addTo(map); // stationLayer = L.geoJson().addTo(map);
stationLayer = new L.MarkerGroup().addTo(map); stationLayer = new L.MarkerGroup().addTo(map);

View File

@ -90,7 +90,7 @@ var eventDetails = {};
var stationTable = {}; var stationTable = {};
var config = { var config = {
ajax: { ajax: {
timeout: 10000, // 10 seconds timeout: 20000, // 20 seconds
eventURL: '/fdsnws/event/1/query', eventURL: '/fdsnws/event/1/query',
dlsvURL: 'dlsv', dlsvURL: 'dlsv',
mseedURL: '/fdsnws/dataselect/1/query', mseedURL: '/fdsnws/dataselect/1/query',