Populate layers from URL

This commit is contained in:
Chandler Swift 2024-03-09 19:54:43 -06:00
parent 7917d1a1e7
commit 9b48d1c782
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F

View file

@ -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);
} }