Added ability to specify custom overlays in configuration
Analogous to adding base layers, custom overlays can be added in
the `config.js` file:
```javascript
BR.conf.overlays = {
'Hill shading': 'http://{s}.tiles.wmflabs.org/hillshading/{z}/{x}/{y}.png'
};
```
This commit is contained in:
parent
42d04e52c2
commit
ffff29dfcc
3 changed files with 61 additions and 55 deletions
94
dist/brouter-web.js
vendored
94
dist/brouter-web.js
vendored
File diff suppressed because one or more lines are too long
2
dist/brouter-web.js.map
vendored
2
dist/brouter-web.js.map
vendored
File diff suppressed because one or more lines are too long
20
js/index.js
20
js/index.js
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
BRouter web - web client for BRouter bike routing engine
|
||||
|
||||
|
||||
Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
function initMap() {
|
||||
L.Icon.Default.imagePath = 'dist/images';
|
||||
|
||||
|
||||
var osmAttribution = '© <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
||||
var maxZoom = 19;
|
||||
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
});
|
||||
|
||||
map = new L.Map('map', {
|
||||
center: new L.LatLng(50.99, 9.86),
|
||||
center: new L.LatLng(50.99, 9.86),
|
||||
zoom: 6,
|
||||
worldCopyJump: true
|
||||
});
|
||||
|
|
@ -104,6 +104,12 @@
|
|||
baseLayers[i] = L.tileLayer(BR.conf.baseLayers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (i in BR.conf.overlays) {
|
||||
if (BR.conf.overlays.hasOwnProperty(i)) {
|
||||
overlays[i] = L.tileLayer(BR.conf.overlays[i]);
|
||||
}
|
||||
}
|
||||
// after applying custom base layer configurations, add first base layer to map
|
||||
var firstLayer = baseLayers[Object.keys(baseLayers)[0]];
|
||||
if (firstLayer) {
|
||||
|
|
@ -121,9 +127,9 @@
|
|||
var search,
|
||||
router,
|
||||
routing,
|
||||
routesLayer,
|
||||
routingOptions,
|
||||
nogos,
|
||||
routesLayer,
|
||||
routingOptions,
|
||||
nogos,
|
||||
stats,
|
||||
itinerary,
|
||||
elevation,
|
||||
|
|
@ -182,7 +188,7 @@
|
|||
function requestUpdate(updatable) {
|
||||
var track = routing.toPolyline(),
|
||||
segments = routing.getSegments();
|
||||
|
||||
|
||||
updatable.update(track, segments);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue