Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New tiles steamen #1283

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 24 additions & 27 deletions plugins/basemap-stamen.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,45 @@


// use own namespace for plugin
window.plugin.mapTileStamen = function() {};

window.plugin.mapTileStamen = function() {};

window.plugin.mapTileStamen.addLayer = function() {

var types = {
let types = {
'toner': [ 'Toner', 'png', 0, 20 ],
// 'toner-hybrid': [ ' Toner Hybrid', 'png', 0, 20 ], // transparent layer. could be useful over satellite imagery or similar
// 'toner-labels': [ 'Toner Labels', 'png', 0, 20 ], // transparent layer. could be useful over satellite imagery or similar
// 'toner-lines': [ 'Toner Lines', 'png', 0, 20 ], // transparent layer. could be useful over satellite imagery or similar
'toner-background': [ 'Toner Background', 'png', 0, 20 ],
// 'toner-background': [ 'Toner Background', 'png', 0, 20 ], //does not exist anymore
'toner-lite': [ 'Toner Lite', 'png', 0, 20 ],
'watercolor': [ 'Watercolor', 'jpg', 1, 16 ],
};

var baseUrl = window.location.protocol == 'https:' ? 'https://stamen-tiles-{s}.a.ssl.fastly.net/' : 'http://{s}.tile.stamen.com/';


for (var layer in types) {
var info = types[layer];

var name = info[0];
var type = info[1];
var minZoom = info[2];
var maxZoom = info[3];

var mapLayer = new L.TileLayer (baseUrl+'{layer}/{z}/{x}/{y}.{type}', {
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>.',
subdomains: 'abcd',
layer: layer,
type: type,
minZoom: minZoom,

// the certificate from steamen.com is not configured correctly - thatswhy you need to add a security exception for this domain.
let baseUrl = window.location.protocol === 'https:' ? 'https://{s}.tile.stamen.com/' : 'http://{s}.tile.stamen.com/'

for (let layer in types) {
let info = types[layer];
let name = info[0];
let type = info[1];
let minZoom = info[2];
let maxZoom = info[3];

let mapLayer = new L.TileLayer (baseUrl+'{layer}/{z}/{x}/{y}.{type}', {
attribution : 'Map tiles by <a href="https://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>.',
subdomains : 'abcd',
layer : layer,
type : type,
minZoom : minZoom,
maxNativeZoom: maxZoom,
maxZoom: 21
maxZoom : 21
});

layerChooser.addBaseLayer(mapLayer,'Stamen '+name);
}

};

var setup = window.plugin.mapTileStamen.addLayer;
let setup = window.plugin.mapTileStamen.addLayer;

// PLUGIN END //////////////////////////////////////////////////////////

Expand Down