using mapquest leaflet sdk

This commit is contained in:
Kasper D. Fischer 2021-10-18 12:44:04 +02:00
parent 60c7e0ef09
commit 7e7f7d59a0
4 changed files with 62 additions and 64 deletions

View File

@ -36,8 +36,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-providers/1.10.1/leaflet-providers.min.js" integrity="sha512-Ifxj89Ujg72gC/psKB9ystryRYiopmDud2EmNTKC9kz192aQwDKVK1FzWsyPc37tgU0UmRQlNnBM++ZnwIXJ9Q==" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/leaflet.browser.print@1.0.5/dist/leaflet.browser.print.min.js" integrity="sha256-1MQvHEnVXSKwR+XIVswRSBla/B5ohkp5+HJtritIkgE=" crossorigin="anonymous"></script>
<script src="https://api.mqcdn.com/sdk/mapquest-js/v1.3.2/mapquest-core.js"></script>
<link type="text/css" rel="stylesheet" href="https://api.mqcdn.com/sdk/mapquest-js/v1.3.2/mapquest-core.css"/>
<script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-map.js?key=RPOPuz3lA2GGBtVpEU0ugxtVoGba53Dt"></script>
<!-- Map, Events & Stations -->
<script type="text/javascript" src="misc.js"></script>

View File

@ -36,8 +36,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-providers/1.10.1/leaflet-providers.min.js" integrity="sha512-Ifxj89Ujg72gC/psKB9ystryRYiopmDud2EmNTKC9kz192aQwDKVK1FzWsyPc37tgU0UmRQlNnBM++ZnwIXJ9Q==" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/leaflet.browser.print@1.0.5/dist/leaflet.browser.print.min.js" integrity="sha256-1MQvHEnVXSKwR+XIVswRSBla/B5ohkp5+HJtritIkgE=" crossorigin="anonymous"></script>
<script src="https://api.mqcdn.com/sdk/mapquest-js/v1.3.2/mapquest-core.js"></script>
<link type="text/css" rel="stylesheet" href="https://api.mqcdn.com/sdk/mapquest-js/v1.3.2/mapquest-core.css"/>
<script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-map.js?key=RPOPuz3lA2GGBtVpEU0ugxtVoGba53Dt"></script>
<!-- Map, Events & Stations -->
<script type="text/javascript" src="misc.js"></script>

View File

@ -139,38 +139,38 @@ function initMapLink() {
**********************************************************************/
$(document).ready(function() {
if ( config['map']['baselayer'] == 'mapquest' ) {
L.mapquest.key = 'RPOPuz3lA2GGBtVpEU0ugxtVoGba53Dt';
map = L.mapquest.map('map', {
layers: L.mapquest.tileLayer('map'),
zoomControl: false, worldCopyJump: true
}).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
} else {
// 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']);
map = L.map('map', {
center: config['map']['centerDefault'],
zoom: config['map']['zoomDefault'],
zoomControl: false,
worldCopyJump: true
});
// create baselayer
switch ( config['map']['baselayer'] ) {
case 'esrigray': // add ESRI Grayscale World Map (neither city nor road names)
L.tileLayer.provider('Esri.WorldGrayCanvas').addTo(map);
break;
case 'aerial': // add ESRI WordImagery tile layer
L.tileLayer.provider('Esri.WorldImagery').addTo(map);
break;
case 'opentopo': // add OpenTopoMap tile layer
L.tileLayer.provider('OpenTopoMap').addTo(map);
break;
case 'mapnik': // add OpenStreetMap.Mapnik tile layer
L.tileLayer.provider('OpenStreetMap.Mapnik').addTo(map);
break;
case 'topplus': // add TopPlus tile layer (https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wmts-topplusopen-wmts-topplus-open.html)
L.tileLayer('https://sgx.geodatenzentrum.de/wmts_topplus_open/tile/1.0.0/web/default/WEBMERCATOR/{z}/{y}/{x}.png',
{attribution: '&copy; Bundesamt für Kartographie und Geodäsie ('+jahr+'), Datenquellen: <a href="http://sg.geodatenzentrum.de/web_public/Datenquellen_TopPlus_Open.pdf">Geodatenzentrum</a>'}).addTo(map);
break;
default: // use OpenStreetMap.DE as default
L.tileLayer.provider('OpenStreetMap.DE').addTo(map);
};
// change baselayer if mapquest is not requested
switch ( config['map']['baselayer'] ) {
case 'esrigray': // add ESRI Grayscale World Map (neither city nor road names)
L.tileLayer.provider('Esri.WorldGrayCanvas').addTo(map);
break;
case 'aerial': // add ESRI WordImagery tile layer
L.tileLayer.provider('Esri.WorldImagery').addTo(map);
break;
case 'opentopo': // add OpenTopoMap tile layer
L.tileLayer.provider('OpenTopoMap').addTo(map);
break;
case 'mapnik': // add OpenStreetMap.Mapnik tile layer
L.tileLayer.provider('OpenStreetMap.Mapnik').addTo(map);
break;
case 'topplus': // add TopPlus tile layer (https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wmts-topplusopen-wmts-topplus-open.html)
L.tileLayer('https://sgx.geodatenzentrum.de/wmts_topplus_open/tile/1.0.0/web/default/WEBMERCATOR/{z}/{y}/{x}.png',
{attribution: '&copy; Bundesamt für Kartographie und Geodäsie ('+jahr+'), Datenquellen: <a href="http://sg.geodatenzentrum.de/web_public/Datenquellen_TopPlus_Open.pdf">Geodatenzentrum</a>'}).addTo(map);
break;
case 'mapquest':
MQ.mapLayer().addTo(map);
break;
default: // use OpenStreetMap.DE as default
L.tileLayer.provider('OpenStreetMap.DE').addTo(map);
};
// add controls
new L.Control.Zoom({ position: 'topright' }).addTo(map);
new L.control.scale({position: 'bottomright', imperial: false}).addTo(map);

View File

@ -139,38 +139,38 @@ function initMapLink() {
**********************************************************************/
$(document).ready(function() {
if ( config['map']['baselayer'] == 'mapquest' ) {
L.mapquest.key = 'RPOPuz3lA2GGBtVpEU0ugxtVoGba53Dt';
map = L.mapquest.map('map', {
layers: L.mapquest.tileLayer('map'),
zoomControl: false, worldCopyJump: true
}).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
} else {
// 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']);
map = L.map('map', {
center: config['map']['centerDefault'],
zoom: config['map']['zoomDefault'],
zoomControl: false,
worldCopyJump: true
});
// create baselayer
switch ( config['map']['baselayer'] ) {
case 'esrigray': // add ESRI Grayscale World Map (neither city nor road names)
L.tileLayer.provider('Esri.WorldGrayCanvas').addTo(map);
break;
case 'aerial': // add ESRI WordImagery tile layer
L.tileLayer.provider('Esri.WorldImagery').addTo(map);
break;
case 'opentopo': // add OpenTopoMap tile layer
L.tileLayer.provider('OpenTopoMap').addTo(map);
break;
case 'mapnik': // add OpenStreetMap.Mapnik tile layer
L.tileLayer.provider('OpenStreetMap.Mapnik').addTo(map);
break;
case 'topplus': // add TopPlus tile layer (https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wmts-topplusopen-wmts-topplus-open.html)
L.tileLayer('https://sgx.geodatenzentrum.de/wmts_topplus_open/tile/1.0.0/web/default/WEBMERCATOR/{z}/{y}/{x}.png',
{attribution: '&copy; Federal Agency for Cartography and Geodesy ('+jahr+'), Datasource: <a href="http://sg.geodatenzentrum.de/web_public/Datenquellen_TopPlus_Open.pdf">Geodatenzentrum</a>'}).addTo(map);
break;
default: // use OpenStreetMap.DE as default
L.tileLayer.provider('OpenStreetMap.DE').addTo(map);
};
// change baselayer if mapquest is not requested
switch ( config['map']['baselayer'] ) {
case 'esrigray': // add ESRI Grayscale World Map (neither city nor road names)
L.tileLayer.provider('Esri.WorldGrayCanvas').addTo(map);
break;
case 'aerial': // add ESRI WordImagery tile layer
L.tileLayer.provider('Esri.WorldImagery').addTo(map);
break;
case 'opentopo': // add OpenTopoMap tile layer
L.tileLayer.provider('OpenTopoMap').addTo(map);
break;
case 'mapnik': // add OpenStreetMap.Mapnik tile layer
L.tileLayer.provider('OpenStreetMap.Mapnik').addTo(map);
break;
case 'topplus': // add TopPlus tile layer (https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wmts-topplusopen-wmts-topplus-open.html)
L.tileLayer('https://sgx.geodatenzentrum.de/wmts_topplus_open/tile/1.0.0/web/default/WEBMERCATOR/{z}/{y}/{x}.png',
{attribution: '&copy; Federal Agency for Cartography and Geodesy ('+jahr+'), Datasource: <a href="http://sg.geodatenzentrum.de/web_public/Datenquellen_TopPlus_Open.pdf">Geodatenzentrum</a>'}).addTo(map);
break;
case 'mapquest':
MQ.mapLayer().addTo(map);
break;
default: // use OpenStreetMap.DE as default
L.tileLayer.provider('OpenStreetMap.DE').addTo(map);
};
// add controls
new L.Control.Zoom({ position: 'topright' }).addTo(map);
new L.control.scale({position: 'bottomright', imperial: false}).addTo(map);