ensure all tiles loaded over https
This commit is contained in:
parent
852dfddd47
commit
5f074740ff
@ -1,5 +1,6 @@
|
||||
### Change Log for Node-RED Worldmap
|
||||
|
||||
- v1.5.26 - Ensure all map tiles loaded over https
|
||||
- v1.5.25 - Add button command to allow user to add and remove buttons
|
||||
- v1.5.24 - ensure hiderightclick does do that, and popup always has close button. Issue #69, #70
|
||||
- v1.5.23 - Let icon support use of emoji specified as :emoji name:
|
||||
|
@ -9,6 +9,7 @@ map web page for plotting "things" on.
|
||||
|
||||
### Updates
|
||||
|
||||
- v1.5.26 - Ensure all map tiles loaded over https
|
||||
- v1.5.25 - Add button command to allow user to add and remove buttons
|
||||
- v1.5.24 - Ensure hiderightclick does do that, and popup always has close button. Issue #69, #70
|
||||
- v1.5.23 - Let icon support use of emoji specified as :emoji name:
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-contrib-web-worldmap",
|
||||
"version": "1.5.25",
|
||||
"version": "1.5.26",
|
||||
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
||||
"dependencies": {
|
||||
"cgi": "0.3.1",
|
||||
|
@ -58,7 +58,6 @@
|
||||
<script type="text/javascript" src="leaflet/L.Terminator.js"></script>
|
||||
<script type="text/javascript" src="leaflet/leaflet-velocity.min.js"></script>
|
||||
<script type="text/javascript" src="leaflet/leaflet-side-by-side.js"></script>
|
||||
<script type="text/javascript" src="leaflet/tile.stamen.js"></script>
|
||||
<script type="text/javascript" src="leaflet/OSMBuildings-Leaflet.js"></script>
|
||||
<script type="text/javascript" src="leaflet/leaflet-omnivore.min.js"></script>
|
||||
<script type="text/javascript" src="leaflet/leaflet.label.js"></script>
|
||||
@ -732,9 +731,10 @@ var NLS_OS_opendata = L.tileLayer('https://geo.nls.uk/maps/opendata/{z}/{x}/{y}.
|
||||
});
|
||||
basemaps["UK OS Opendata"] = NLS_OS_opendata;
|
||||
|
||||
var HikeBike_HikeBike = L.tileLayer('http://{s}.tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png', {
|
||||
//https://tiles.wmflabs.org/hikebike/{zoom}/{x}/{y}.png
|
||||
var HikeBike_HikeBike = L.tileLayer('https://tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
});
|
||||
basemaps["Hike Bike"] = HikeBike_HikeBike;
|
||||
|
||||
@ -760,11 +760,25 @@ basemaps["UK OS 1900"] = NLS_OS_1900;
|
||||
//});
|
||||
//basemaps["CartoDB Light"] = CartoPos;
|
||||
|
||||
// Terrain map by Stamen Design
|
||||
basemaps["Terrain"] = new L.StamenTileLayer('terrain');
|
||||
// Nice terrain based maps by Stamen Design
|
||||
var terrainUrl = "https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg";
|
||||
basemaps["Terrain"] = L.tileLayer(terrainUrl, {
|
||||
subdomains: ['a','b','c','d'],
|
||||
minZoom: 0,
|
||||
maxZoom: 20,
|
||||
type: 'jpg',
|
||||
attribution: 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, under <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'
|
||||
});
|
||||
|
||||
// Nice watercolour based maps by Stamen Design
|
||||
basemaps["Watercolor"] = new L.StamenTileLayer('watercolor');
|
||||
var watercolorUrl = "https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg";
|
||||
basemaps["Watercolor"] = L.tileLayer(watercolorUrl, {
|
||||
subdomains: ['a','b','c','d'],
|
||||
minZoom: 0,
|
||||
maxZoom: 20,
|
||||
type: 'jpg',
|
||||
attribution: 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, under <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'
|
||||
});
|
||||
|
||||
|
||||
// Now add the overlays
|
||||
@ -817,20 +831,20 @@ map.removeLayer(overlays["buildings"]); // Hide it at start
|
||||
// Add Roads
|
||||
overlays["roads"] = L.tileLayer('https://{s}.tile.openstreetmap.se/hydda/roads_and_labels/{z}/{x}/{y}.png', {
|
||||
maxZoom: 18,
|
||||
attribution: 'Tiles courtesy of <a href="http://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
||||
attribution: 'Tiles courtesy of <a href="https://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
||||
opacity: 0.8
|
||||
});
|
||||
|
||||
// Add Railways
|
||||
overlays["railways"] = L.tileLayer('https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: 'Map data: © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> | Map style: © <a href="https://www.OpenRailwayMap.org">OpenRailwayMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
|
||||
attribution: 'Map data: © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | Map style: © <a href="https://www.OpenRailwayMap.org">OpenRailwayMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
|
||||
});
|
||||
|
||||
// Add Public Transport (Buses)
|
||||
overlays["public transport"] = L.tileLayer('http://openptmap.org/tiles/{z}/{x}/{y}.png', {
|
||||
overlays["public transport"] = L.tileLayer('https://openptmap.org/tiles/{z}/{x}/{y}.png', {
|
||||
maxZoom: 17,
|
||||
attribution: 'Map data: © <a href="http://www.openptmap.org">OpenPtMap</a> contributors'
|
||||
attribution: 'Map data: © <a href="https://www.openptmap.org">OpenPtMap</a> contributors'
|
||||
});
|
||||
|
||||
// Add the OpenSea markers layer
|
||||
@ -1031,7 +1045,7 @@ function setMarker(data) {
|
||||
else if (data.icon === "plane") {
|
||||
data.iconColor = data.iconColor || "black";
|
||||
if (data.hasOwnProperty("squawk")) { data.iconColor = "red"; }
|
||||
icon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="310px" height="310px" viewBox="0 0 310 310">';
|
||||
icon = '<svg xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" x="0px" y="0px" width="310px" height="310px" viewBox="0 0 310 310">';
|
||||
icon += '<path d="M134.875,19.74c0.04-22.771,34.363-22.771,34.34,0.642v95.563L303,196.354v35.306l-133.144-43.821v71.424l30.813,24.072v27.923l-47.501-14.764l-47.501,14.764v-27.923l30.491-24.072v-71.424L3,231.66v-35.306l131.875-80.409V19.74z" fill="'+data.iconColor+'"/></svg>';
|
||||
var svgplane = "data:image/svg+xml;base64," + btoa(icon);
|
||||
var dir = parseFloat(data.hdg || data.bearing || "0");
|
||||
@ -1047,7 +1061,7 @@ function setMarker(data) {
|
||||
else if (data.icon === "uav") {
|
||||
data.iconColor = data.iconColor || "black";
|
||||
if (data.hasOwnProperty("squawk")) { data.iconColor = "red"; }
|
||||
icon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100">';
|
||||
icon = '<svg xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" viewBox="0 0 100 100">';
|
||||
icon+= '<path d="M62 82h-8V64h36c0-5-4-9-9-9H54v-8c0-3 4-5 4-11.1 0-4.4-3.6-8-8-8-4.4 0-8 3.6-8 8 0 5.1 4 8.1 4 11.1V55h-27c-5 0-9 4-9 9h36v18H38c-2.4 0-5 2.3-5 5L50 92l17-5C67 84.3 64.4 82 62 82z" fill="'+data.iconColor+'"/></svg>';
|
||||
var svguav = "data:image/svg+xml;base64," + btoa(icon);
|
||||
var dir = parseFloat(data.hdg || data.bearing || "0");
|
||||
@ -1060,7 +1074,7 @@ function setMarker(data) {
|
||||
}
|
||||
else if (data.icon === "car") {
|
||||
data.iconColor = data.iconColor || "black";
|
||||
icon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="47px" height="47px" viewBox="0 0 47 47">';
|
||||
icon = '<svg xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" x="0px" y="0px" width="47px" height="47px" viewBox="0 0 47 47">';
|
||||
icon += '<path d="M29.395,0H17.636c-3.117,0-5.643,3.467-5.643,6.584v34.804c0,3.116,2.526,5.644,5.643,5.644h11.759 c3.116,0,5.644-2.527,5.644-5.644V6.584C35.037,3.467,32.511,0,29.395,0z M34.05,14.188v11.665l-2.729,0.351v-4.806L34.05,14.188z M32.618,10.773c-1.016,3.9-2.219,8.51-2.219,8.51H16.631l-2.222-8.51C14.41,10.773,23.293,7.755,32.618,10.773z M15.741,21.713 v4.492l-2.73-0.349V14.502L15.741,21.713z M13.011,37.938V27.579l2.73,0.343v8.196L13.011,37.938z M14.568,40.882l2.218-3.336 h13.771l2.219,3.336H14.568z M31.321,35.805v-7.872l2.729-0.355v10.048L31.321,35.805z" fill="'+data.iconColor+'"/></svg>';
|
||||
var svgcar = "data:image/svg+xml;base64," + btoa(icon);
|
||||
var dir = parseFloat(data.hdg || data.bearing || "0");
|
||||
@ -1073,7 +1087,7 @@ function setMarker(data) {
|
||||
}
|
||||
else if (data.icon === "arrow") {
|
||||
data.iconColor = data.iconColor || "black";
|
||||
icon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32px" height="32px" viewBox="0 0 32 32">';
|
||||
icon = '<svg xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" width="32px" height="32px" viewBox="0 0 32 32">';
|
||||
icon += '<path d="m16.2 0.6l-10.9 31 10.7-11.1 10.5 11.1 -10.3-31z" fill="'+data.iconColor+'"/></svg>';
|
||||
var svgarrow = "data:image/svg+xml;base64," + btoa(icon);
|
||||
var dir = parseFloat(data.hdg || data.bearing || "0");
|
||||
@ -1086,7 +1100,7 @@ function setMarker(data) {
|
||||
}
|
||||
else if (data.icon === "wind") {
|
||||
data.iconColor = data.iconColor || "black";
|
||||
icon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32px" height="32px" viewBox="0 0 32 32">';
|
||||
icon = '<svg xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" width="32px" height="32px" viewBox="0 0 32 32">';
|
||||
icon += '<path d="M16.7 31.7l7-6.9c0.4-0.4 0.4-1 0-1.4 -0.4-0.4-1-0.4-1.4 0l-5.3 5.2V17.3l6.7-6.6c0.2-0.2 0.3-0.5 0.3-0.7v-9c0-0.9-1.1-1.3-1.7-0.7l-6.3 6.2L9.7 0.3C9.1-0.3 8 0.1 8 1.1v8.8c0 0.3 0.1 0.6 0.3 0.8l6.7 6.6v11.3l-5.3-5.2c-0.4-0.4-1-0.4-1.4 0 -0.4 0.4-0.4 1 0 1.4l7 6.9c0.2 0.2 0.5 0.3 0.7 0.3C16.2 32 16.5 31.9 16.7 31.7zM10 9.6V3.4l5 4.9v6.2L10 9.6zM17 8.3l5-4.9v6.2l-5 4.9V8.3z" fill="'+data.iconColor+'"/></svg>';
|
||||
var svgwind = "data:image/svg+xml;base64," + btoa(icon);
|
||||
var dir = parseFloat(data.hdg || data.bearing || "0");
|
||||
@ -1099,7 +1113,7 @@ function setMarker(data) {
|
||||
}
|
||||
else if (data.icon === "satellite") {
|
||||
data.iconColor = data.iconColor || "black";
|
||||
icon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100">';
|
||||
icon = '<svg xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" viewBox="0 0 100 100">';
|
||||
icon += '<polygon points="38.17 39.4 45.24 32.33 43.34 27.92 24.21 8.78 14.59 18.4 33.72 37.53" fill="'+data.iconColor+'"/>';
|
||||
icon += '<path d="M69.22 44.57L54.38 29.73c-1.1-1.1-2.91-1.1-4.01 0L35.53 44.57c-1.1 1.1-1.1 2.91 0 4.01l14.84 14.84c1.1 1.1 2.91 1.1 4.01 0l14.84-14.84C70.32 47.47 70.32 45.67 69.22 44.57z" fill="'+data.iconColor+'"/>';
|
||||
icon += '<polygon points="71.04 55.61 66.58 53.75 59.52 60.82 61.42 65.23 80.55 84.36 90.17 74.75" fill="'+data.iconColor+'"/>';
|
||||
@ -1116,7 +1130,7 @@ function setMarker(data) {
|
||||
}
|
||||
else if ((data.icon === "iss") || (data.icon === "ISS")) {
|
||||
data.iconColor = data.iconColor || "black";
|
||||
icon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48">';
|
||||
icon = '<svg xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" viewBox="0 0 48 48">';
|
||||
icon += '<path id="iss" d="m4.55 30.97l6.85-12.68 0.59 0.32 -6.85 12.68 4.27 2.3 6.85-12.68 0.49 0.27 -0.81 1.5c-0.26 0.48-0.07 1.1 0.44 1.37l5.09 2.75c0.5 0.27 1.12 0.1 1.38-0.39l0.81-1.5 0.72 0.39 -1.49 2.75c-0.41 0.76-0.38 1.58 0.08 1.82l4.61 2.49c0.45 0.24 1.15-0.18 1.56-0.94l1.49-2.75 0.69 0.37 -6.85 12.68 4.26 2.3 6.85-12.68 0.59 0.32 -6.85 12.69 4.26 2.3 14.46-26.78 -4.26-2.3 -6.88 12.74 -0.59-0.32 6.88-12.74 -4.26-2.3 -6.88 12.74 -0.69-0.37 1.49-2.75c0.41-0.76 ';
|
||||
icon += '0.38-1.58-0.08-1.82l-1.4-0.75 0.5-0.92c1.02 0.17 2.09-0.32 2.62-1.3 0.67-1.23 0.22-2.76-0.99-3.42 -1.21-0.65-2.74-0.19-3.4 1.05 -0.53 0.98-0.35 2.14 0.35 2.9l-0.5 0.92 -1.8-0.97c-0.45-0.24-1.15 0.17-1.57 0.94l-1.49 2.75 -0.72-0.39 0.81-1.5c0.26-0.48 0.07-1.1-0.44-1.36l-5.09-2.75c-0.5-0.27-1.12-0.1-1.38 0.39l-0.81 1.5 -0.49-0.27 6.88-12.74 -4.26-2.3 -6.88 12.74 -0.59-0.32 6.88-12.74 -4.26-2.3 -14.46 26.78 4.26 2.3zm14.26-11.72c0.2-0.37 0.68-0.51 1.06-0.3l3.93 ';
|
||||
icon += '2.12c0.39 0.21 0.54 0.68 0.34 1.05l-1.81 3.35c-0.2 0.37-0.68 0.51-1.06 0.3l-3.93-2.12c-0.38-0.21-0.53-0.68-0.33-1.05l1.81-3.35zm12.01-1.46c0.45-0.83 1.47-1.14 2.28-0.7 0.81 0.44 1.11 1.46 0.66 2.29 -0.44 0.83-1.47 1.14-2.28 0.7 -0.81-0.44-1.11-1.46-0.66-2.29zm-3.78 4.26c0.35-0.66 0.93-1.04 1.28-0.85l3.57 1.93c0.35 0.19 0.35 0.88-0.01 1.53l-3.19 5.91c-0.35 0.66-0.93 1.04-1.28 0.85l-3.56-1.92c-0.35-0.19-0.35-0.88 0.01-1.53l3.19-5.91zm0.19 7.49c-0.26 0.49-0.87 ';
|
||||
@ -1132,7 +1146,7 @@ function setMarker(data) {
|
||||
}
|
||||
else if (data.icon === "locate") {
|
||||
data.iconColor = data.iconColor || "cyan";
|
||||
icon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="468px" height="468px" viewBox="0 0 468 468">';
|
||||
icon = '<svg xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" x="0px" y="0px" width="468px" height="468px" viewBox="0 0 468 468">';
|
||||
icon += '<polygon points="32 32 104 32 104 0 0 0 0 104 32 104" fill="'+data.iconColor+'"/>';
|
||||
icon += '<polygon points="468 0 364 0 364 32 436 32 436 104 468 104" fill="'+data.iconColor+'"/>';
|
||||
icon += '<polygon points="0 468 104 468 104 436 32 436 32 364 0 364" fill="'+data.iconColor+'"/>';
|
||||
|
@ -1,220 +0,0 @@
|
||||
(function(exports) {
|
||||
|
||||
/*
|
||||
* tile.stamen.js v1.2.4
|
||||
*/
|
||||
|
||||
var SUBDOMAINS = " a. b. c. d.".split(" "),
|
||||
MAKE_PROVIDER = function(layer, type, minZoom, maxZoom) {
|
||||
return {
|
||||
"url": ["http://{S}tile.stamen.com/", layer, "/{Z}/{X}/{Y}.", type].join(""),
|
||||
"type": type,
|
||||
"subdomains": SUBDOMAINS.slice(),
|
||||
"minZoom": minZoom,
|
||||
"maxZoom": maxZoom,
|
||||
"attribution": [
|
||||
'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ',
|
||||
'under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. ',
|
||||
'Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, ',
|
||||
'under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'
|
||||
].join("")
|
||||
};
|
||||
},
|
||||
PROVIDERS = {
|
||||
"toner": MAKE_PROVIDER("toner", "png", 0, 20),
|
||||
"terrain": MAKE_PROVIDER("terrain", "jpg", 4, 18),
|
||||
"watercolor": MAKE_PROVIDER("watercolor", "jpg", 1, 18),
|
||||
"trees-cabs-crime": {
|
||||
"url": "http://{S}.tiles.mapbox.com/v3/stamen.trees-cabs-crime/{Z}/{X}/{Y}.png",
|
||||
"type": "png",
|
||||
"subdomains": "a b c d".split(" "),
|
||||
"minZoom": 11,
|
||||
"maxZoom": 18,
|
||||
"extent": [
|
||||
{"lat": 37.853, "lon": -122.577},
|
||||
{"lat": 37.684, "lon": -122.313}
|
||||
],
|
||||
"attribution": [
|
||||
'Design by Shawn Allen at <a href="http://stamen.com">Stamen</a>.',
|
||||
'Data courtesy of <a href="http://fuf.net">FuF</a>,',
|
||||
'<a href="http://www.yellowcabsf.com">Yellow Cab</a>',
|
||||
'& <a href="http://sf-police.org">SFPD</a>.'
|
||||
].join(" ")
|
||||
}
|
||||
};
|
||||
|
||||
// set up toner and terrain flavors
|
||||
setupFlavors("toner", ["hybrid", "labels", "lines", "background", "lite"]);
|
||||
// toner 2010
|
||||
setupFlavors("toner", ["2010"]);
|
||||
// toner 2011 flavors
|
||||
setupFlavors("toner", ["2011", "2011-lines", "2011-labels", "2011-lite"]);
|
||||
setupFlavors("terrain", ["background"]);
|
||||
setupFlavors("terrain", ["labels", "lines"], "png");
|
||||
|
||||
/*
|
||||
* Export stamen.tile to the provided namespace.
|
||||
*/
|
||||
exports.stamen = exports.stamen || {};
|
||||
exports.stamen.tile = exports.stamen.tile || {};
|
||||
exports.stamen.tile.providers = PROVIDERS;
|
||||
exports.stamen.tile.getProvider = getProvider;
|
||||
|
||||
/*
|
||||
* A shortcut for specifying "flavors" of a style, which are assumed to have the
|
||||
* same type and zoom range.
|
||||
*/
|
||||
function setupFlavors(base, flavors, type) {
|
||||
var provider = getProvider(base);
|
||||
for (var i = 0; i < flavors.length; i++) {
|
||||
var flavor = [base, flavors[i]].join("-");
|
||||
PROVIDERS[flavor] = MAKE_PROVIDER(flavor, type || provider.type, provider.minZoom, provider.maxZoom);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the named provider, or throw an exception if it doesn't exist.
|
||||
*/
|
||||
function getProvider(name) {
|
||||
if (name in PROVIDERS) {
|
||||
return PROVIDERS[name];
|
||||
} else {
|
||||
throw 'No such provider (' + name + ')';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* StamenTileLayer for modestmaps-js
|
||||
* <https://github.com/modestmaps/modestmaps-js/>
|
||||
*
|
||||
* Works with both 1.x and 2.x by checking for the existence of MM.Template.
|
||||
*/
|
||||
if (typeof MM === "object") {
|
||||
var ModestTemplate = (typeof MM.Template === "function")
|
||||
? MM.Template
|
||||
: MM.TemplatedMapProvider;
|
||||
MM.StamenTileLayer = function(name) {
|
||||
var provider = getProvider(name);
|
||||
this._provider = provider;
|
||||
MM.Layer.call(this, new ModestTemplate(provider.url, provider.subdomains));
|
||||
this.provider.setZoomRange(provider.minZoom, provider.maxZoom);
|
||||
this.attribution = provider.attribution;
|
||||
};
|
||||
|
||||
MM.StamenTileLayer.prototype = {
|
||||
setCoordLimits: function(map) {
|
||||
var provider = this._provider;
|
||||
if (provider.extent) {
|
||||
map.coordLimits = [
|
||||
map.locationCoordinate(provider.extent[0]).zoomTo(provider.minZoom),
|
||||
map.locationCoordinate(provider.extent[1]).zoomTo(provider.maxZoom)
|
||||
];
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
MM.extend(MM.StamenTileLayer, MM.Layer);
|
||||
}
|
||||
|
||||
/*
|
||||
* StamenTileLayer for Leaflet
|
||||
* <http://leaflet.cloudmade.com/>
|
||||
*
|
||||
* Tested with version 0.3 and 0.4, but should work on all 0.x releases.
|
||||
*/
|
||||
if (typeof L === "object") {
|
||||
L.StamenTileLayer = L.TileLayer.extend({
|
||||
initialize: function(name) {
|
||||
var provider = getProvider(name),
|
||||
url = provider.url.replace(/({[A-Z]})/g, function(s) {
|
||||
return s.toLowerCase();
|
||||
});
|
||||
L.TileLayer.prototype.initialize.call(this, url, {
|
||||
"minZoom": provider.minZoom,
|
||||
"maxZoom": provider.maxZoom,
|
||||
"subdomains": provider.subdomains,
|
||||
"scheme": "xyz",
|
||||
"attribution": provider.attribution
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* StamenTileLayer for OpenLayers
|
||||
* <http://openlayers.org/>
|
||||
*
|
||||
* Tested with v2.1x.
|
||||
*/
|
||||
if (typeof OpenLayers === "object") {
|
||||
// make a tile URL template OpenLayers-compatible
|
||||
function openlayerize(url) {
|
||||
return url.replace(/({.})/g, function(v) {
|
||||
return "$" + v.toLowerCase();
|
||||
});
|
||||
}
|
||||
|
||||
// based on http://www.bostongis.com/PrinterFriendly.aspx?content_name=using_custom_osm_tiles
|
||||
OpenLayers.Layer.Stamen = OpenLayers.Class(OpenLayers.Layer.OSM, {
|
||||
initialize: function(name, options) {
|
||||
var provider = getProvider(name),
|
||||
url = provider.url,
|
||||
subdomains = provider.subdomains,
|
||||
hosts = [];
|
||||
if (url.indexOf("{S}") > -1) {
|
||||
for (var i = 0; i < subdomains.length; i++) {
|
||||
hosts.push(openlayerize(url.replace("{S}", subdomains[i])));
|
||||
}
|
||||
} else {
|
||||
hosts.push(openlayerize(url));
|
||||
}
|
||||
options = OpenLayers.Util.extend({
|
||||
"numZoomLevels": provider.maxZoom,
|
||||
"buffer": 0,
|
||||
"transitionEffect": "resize",
|
||||
// see: <http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/OSM-js.html#OpenLayers.Layer.OSM.tileOptions>
|
||||
// and: <http://dev.openlayers.org/apidocs/files/OpenLayers/Tile/Image-js.html#OpenLayers.Tile.Image.crossOriginKeyword>
|
||||
"tileOptions": {
|
||||
"crossOriginKeyword": null
|
||||
}
|
||||
}, options);
|
||||
return OpenLayers.Layer.OSM.prototype.initialize.call(this, name, hosts, options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* StamenMapType for Google Maps API V3
|
||||
* <https://developers.google.com/maps/documentation/javascript/>
|
||||
*/
|
||||
if (typeof google === "object" && typeof google.maps === "object") {
|
||||
google.maps.StamenMapType = function(name) {
|
||||
var provider = getProvider(name),
|
||||
subdomains = provider.subdomains;
|
||||
return google.maps.ImageMapType.call(this, {
|
||||
"getTileUrl": function(coord, zoom) {
|
||||
var numTiles = 1 << zoom,
|
||||
wx = coord.x % numTiles,
|
||||
x = (wx < 0) ? wx + numTiles : wx,
|
||||
y = coord.y,
|
||||
index = (zoom + x + y) % subdomains.length;
|
||||
return provider.url
|
||||
.replace("{S}", subdomains[index])
|
||||
.replace("{Z}", zoom)
|
||||
.replace("{X}", x)
|
||||
.replace("{Y}", y);
|
||||
},
|
||||
"tileSize": new google.maps.Size(256, 256),
|
||||
"name": name,
|
||||
"minZoom": provider.minZoom,
|
||||
"maxZoom": provider.maxZoom
|
||||
});
|
||||
};
|
||||
// FIXME: is there a better way to extend classes in Google land?
|
||||
google.maps.StamenMapType.prototype = new google.maps.ImageMapType("_");
|
||||
}
|
||||
|
||||
})(typeof exports === "undefined" ? this : exports);
|
@ -1,5 +1,5 @@
|
||||
CACHE MANIFEST
|
||||
# date: Feb 21st 2019 - v1.5.25
|
||||
# date: Feb 23rd 2019 - v1.5.26
|
||||
|
||||
CACHE:
|
||||
index.html
|
||||
@ -50,7 +50,6 @@ leaflet/milsymbol.js
|
||||
leaflet/nvg.js
|
||||
leaflet/OSMBuildings-Leaflet.js
|
||||
leaflet/sockjs.min.js
|
||||
leaflet/tile.stamen.js
|
||||
leaflet/images/layers-2x.png
|
||||
leaflet/images/layers.png
|
||||
leaflet/images/marker-icon-2x.png
|
||||
|
Loading…
Reference in New Issue
Block a user