add config option for custom base layers, resolves #24
This commit is contained in:
parent
bfe1f7eea9
commit
327c343903
2 changed files with 21 additions and 3 deletions
|
|
@ -58,4 +58,13 @@
|
|||
// External URL for key retrieval, does not work locally on desktop
|
||||
BR.conf.bingKeyUrl = 'http://norbertrenner.de/key/bing.php';
|
||||
|
||||
// Add custom tile layers
|
||||
// URL template see http://leafletjs.com/reference.html#tilelayer
|
||||
// Multiple entries separated by comma (,)
|
||||
BR.conf.baseLayers = {
|
||||
// 'display name': 'url'[,]
|
||||
// e.g. for offline tiles with https://github.com/develar/mapsforge-tile-server
|
||||
//'Mapsforge Tile Server': 'http://localhost:6090/{z}/{x}/{y}.png'
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
15
js/index.js
15
js/index.js
|
|
@ -78,17 +78,26 @@
|
|||
+ 'routing + map data © <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors '
|
||||
+ '(<a target="_blank" href="http://opendatacommons.org/licenses/odbl/">ODbL</a>)');
|
||||
|
||||
layersControl = L.control.layers({
|
||||
var baseLayers = {
|
||||
'OpenStreetMap': osm,
|
||||
'OpenStreetMap.de': osmde,
|
||||
'OpenTopoMap': topo,
|
||||
'OpenCycleMap (Thunderf.)': cycle,
|
||||
'Outdoors (Thunderforest)': outdoors,
|
||||
'Bing Aerial': bing
|
||||
}, {
|
||||
};
|
||||
var overlays = {
|
||||
'Cycling (Waymarked Trails)': cycling,
|
||||
'Hiking (Waymarked Trails)': hiking
|
||||
}).addTo(map);
|
||||
};
|
||||
|
||||
for (i in BR.conf.baseLayers) {
|
||||
if (BR.conf.baseLayers.hasOwnProperty(i)) {
|
||||
baseLayers[i] = L.tileLayer(BR.conf.baseLayers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
layersControl = L.control.layers(baseLayers, overlays).addTo(map);
|
||||
|
||||
// expose map instance for console debugging
|
||||
BR.debug = BR.debug || {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue