[basemap-openstreetmap] add Humantarian style

This commit is contained in:
fkloft
2015-10-11 23:16:24 +02:00
parent e35d2ac743
commit 95acdd773e

View File

@ -24,18 +24,27 @@
// use own namespace for plugin // use own namespace for plugin
window.plugin.mapTileOpenStreetMap = function() {}; window.plugin.mapTileOpenStreetMap = {
addLayer: function() {
// OpenStreetMap tiles - we shouldn't use these by default - https://wiki.openstreetmap.org/wiki/Tile_usage_policy
// "Heavy use (e.g. distributing an app that uses tiles from openstreetmap.org) is forbidden without prior permission from the System Administrators"
window.plugin.mapTileOpenStreetMap.addLayer = function() { var osmOpt = {
attribution: 'Map data © OpenStreetMap contributors',
maxNativeZoom: 18,
maxZoom: 21,
};
//OpenStreetMap tiles - we shouldn't use these by default - https://wiki.openstreetmap.org/wiki/Tile_usage_policy var layers = {
// "Heavy use (e.g. distributing an app that uses tiles from openstreetmap.org) is forbidden without prior permission from the System Administrators" 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png': 'OpenStreetMap',
'http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png': 'Humanitarian',
};
osmAttribution = 'Map data © OpenStreetMap contributors'; for(var url in layers) {
var osmOpt = {attribution: osmAttribution, maxNativeZoom: 18, maxZoom: 21}; var layer = new L.TileLayer(url, osmOpt);
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmOpt); layerChooser.addBaseLayer(layer, layers[url]);
}
layerChooser.addBaseLayer(osm, "OpenStreetMap"); },
}; };
var setup = window.plugin.mapTileOpenStreetMap.addLayer; var setup = window.plugin.mapTileOpenStreetMap.addLayer;