split 256px and 512px sources

This commit is contained in:
vcoppe committed 2026-11-29 16:37:22 +01:00
1 parent 4e4142dabc
commit 9372df1c61
4 files changed
+154 -42

No files matched your search

+18
View File
@@ -16,6 +16,12 @@ import {
} from '$lib/data/layers';
import { getLayers, getOpacityPaint, prefixStyle } from '$lib/components/map/layer-control/utils';
import { i18n } from '$lib/i18n/i18n.svelte';
import {
OPEN_SATELLITE_FALLBACK_PROTOCOL,
OPEN_SATELLITE_PROTOCOL,
openSatelliteAttribution,
openSatelliteFallbackAttribution,
} from '$lib/components/map/open-satellite';
const { currentBasemap, currentOverlays, customLayers, opacities, terrainSource, distanceUnits } =
settings;
@@ -123,6 +129,18 @@ export class StyleManager {
) {
src.url = src.url.replace(maptilerKeyPlaceHolder, this._maptilerKey);
}
if (src && typeof src === 'object' && 'tiles' in src) {
// the credits of the open satellite imagery, kept with its code
if (src.tiles?.some((url) => url.startsWith(`${OPEN_SATELLITE_PROTOCOL}://`))) {
src.attribution = openSatelliteAttribution;
} else if (
src.tiles?.some((url) =>
url.startsWith(`${OPEN_SATELLITE_FALLBACK_PROTOCOL}://`)
)
) {
src.attribution = openSatelliteFallbackAttribution;
}
}
}
} catch (e) {
console.error(e instanceof Error ? e.message : e);