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:
Sascha Hagedorn 2016-06-29 20:37:54 +02:00
parent 42d04e52c2
commit ffff29dfcc
3 changed files with 61 additions and 55 deletions

92
dist/brouter-web.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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) {