Populate layers from URL
This commit is contained in:
parent
7917d1a1e7
commit
9b48d1c782
6
main.js
6
main.js
|
@ -119,8 +119,14 @@ for (let category of layerCategories) {
|
||||||
document.querySelector("aside").appendChild(catDiv);
|
document.querySelector("aside").appendChild(catDiv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const urlLayers = urlParams.getAll('layer');
|
||||||
|
|
||||||
for (let category of layerCategories) {
|
for (let category of layerCategories) {
|
||||||
for (let layer of category.layers) {
|
for (let layer of category.layers) {
|
||||||
|
if (urlLayers.includes(layer.name)) {
|
||||||
|
layer.enabled = true;
|
||||||
|
}
|
||||||
if (layer.enabled) {
|
if (layer.enabled) {
|
||||||
map.addLayer(layer.layer);
|
map.addLayer(layer.layer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue