Disable existing layers if selecting via URL

This probably breaks existing links that assume a basemap, but…meh!

Otherwise there's no way to disable my location layer nor the basemap,
both of which are on by default.

Requested-By: Eric Villnow <eric@vill.now>
This commit is contained in:
Chandler Swift 2025-10-12 22:37:23 -05:00
parent 1ea90a0f69
commit ca8aa335e5
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F

View file

@ -132,6 +132,10 @@ for (let category of layerCategories) {
const urlParams = qs.parse(window.location.search, { ignoreQueryPrefix: true });
const urlLayers = ('layer' in urlParams) ? (typeof urlParams.layer === 'string' ? [urlParams.layer] : urlParams.layer) : [];
if (urlLayers.length > 0) {
// Disable default-enabled layers if we're selecting layers via query params
layerCategories.forEach(c => c.layers.forEach(l => l.enabled = false));
}
for (let category of layerCategories) {
for (let layer of category.layers) {
if (urlLayers.includes(layer.name)) {