diff --git a/public/assets/sunny.json b/public/assets/sunny.json index b0504eb55..0782ef5ae 100644 --- a/public/assets/sunny.json +++ b/public/assets/sunny.json @@ -1147,6 +1147,7 @@ "fill-opacity": 0.5 } }, + { "id": "transit_pier", "type": "line", diff --git a/scripts/generateLayouts.ts b/scripts/generateLayouts.ts index 832ec03d3..60e813169 100644 --- a/scripts/generateLayouts.ts +++ b/scripts/generateLayouts.ts @@ -259,7 +259,7 @@ class GenerateLayouts extends Script { const urls: string[] = [] const regex = /{switch:([^}]+)}/ const rasterLayers = [ - AvailableRasterLayers.maptilerDefaultLayer, + AvailableRasterLayers.defaultBackgroundLayer, ...eli.features, ...eli_global.layers.map((properties) => ({ properties })) ] diff --git a/src/Models/RasterLayers.ts b/src/Models/RasterLayers.ts index 12f725fb3..b5594e907 100644 --- a/src/Models/RasterLayers.ts +++ b/src/Models/RasterLayers.ts @@ -48,26 +48,12 @@ export class AvailableRasterLayers { geometry: BBox.global.asGeometry(), } - public static readonly maptilerDefaultLayer: RasterLayerPolygon = { - type: "Feature", - properties: { - name: "MapTiler", - url: - "https://api.maptiler.com/maps/15cc8f61-0353-4be6-b8da-13daea5f7432/style.json?key=" + - Constants.maptilerApiKey, - style: - "https://api.maptiler.com/maps/15cc8f61-0353-4be6-b8da-13daea5f7432/style.json?key=" + - Constants.maptilerApiKey, - category: "osmbasedmap", - id: "maptiler", - type: "vector", - attribution: { - text: "Maptiler", - url: "https://www.maptiler.com/copyright/", - }, - }, - geometry: BBox.global.asGeometry(), - } + /** + * The default background layer that any theme uses which does not explicitly define a background + */ + public static readonly defaultBackgroundLayer: RasterLayerPolygon = AvailableRasterLayers.globalLayers.find(l => { + return l.properties.id === "protomaps.sunny" + }) public static layersAvailableAt( location: Store<{ lon: number; lat: number }>, @@ -93,7 +79,7 @@ export class AvailableRasterLayers { return GeoOperations.inside(lonlat, eliPolygon) }) matching.unshift(AvailableRasterLayers.osmCarto) - matching.push(AvailableRasterLayers.maptilerDefaultLayer) + matching.push(AvailableRasterLayers.defaultBackgroundLayer) if (enableBing?.data) { matching.push(AvailableRasterLayers.bing) } @@ -110,7 +96,7 @@ export class AvailableRasterLayers { all.push(...AvailableRasterLayers.globalLayers.map((l) => l.properties.id)) all.push(...AvailableRasterLayers.EditorLayerIndex.map((l) => l.properties.id)) all.push(this.osmCarto.properties.id) - all.push(this.maptilerDefaultLayer.properties.id) + all.push(this.defaultBackgroundLayer.properties.id) return new Set(all) } } diff --git a/src/UI/BigComponents/WaySplitMap.svelte b/src/UI/BigComponents/WaySplitMap.svelte index b6b4afd53..183cddf9b 100644 --- a/src/UI/BigComponents/WaySplitMap.svelte +++ b/src/UI/BigComponents/WaySplitMap.svelte @@ -106,6 +106,6 @@
- +
diff --git a/src/UI/DownloadFlow/DownloadPdf.svelte b/src/UI/DownloadFlow/DownloadPdf.svelte index cd518189c..635ca98b6 100644 --- a/src/UI/DownloadFlow/DownloadPdf.svelte +++ b/src/UI/DownloadFlow/DownloadPdf.svelte @@ -25,7 +25,7 @@ const templateUrls = SvgToPdf.templates[templateName].pages const templates: string[] = await Promise.all(templateUrls.map((url) => Utils.download(url))) console.log("Templates are", templates) - const bg = state.mapProperties.rasterLayer.data ?? AvailableRasterLayers.maptilerDefaultLayer + const bg = state.mapProperties.rasterLayer.data ?? AvailableRasterLayers.defaultBackgroundLayer const creator = new SvgToPdf(title, templates, { state, freeComponentId: "belowmap", diff --git a/src/UI/InputElement/Helpers/DirectionInput.svelte b/src/UI/InputElement/Helpers/DirectionInput.svelte index c9660da9c..134fe778e 100644 --- a/src/UI/InputElement/Helpers/DirectionInput.svelte +++ b/src/UI/InputElement/Helpers/DirectionInput.svelte @@ -63,7 +63,7 @@ on:touchstart={(e) => onPosChange(e.touches[0].clientX, e.touches[0].clientY)} >
- +
diff --git a/src/UI/InputElement/Helpers/LocationInput.svelte b/src/UI/InputElement/Helpers/LocationInput.svelte index 3f4570a9c..caa5d0c60 100644 --- a/src/UI/InputElement/Helpers/LocationInput.svelte +++ b/src/UI/InputElement/Helpers/LocationInput.svelte @@ -84,7 +84,7 @@
- +
(zoom) } } + if (!mapProperties.rasterLayer) { + /* mapProperties = { + ...mapProperties, rasterLayer: properties?.mapProperties?.rasterLayer + }*/ + } return mapProperties } @@ -72,7 +77,7 @@ export default class InputHelpers { const searchKey: string = args[0] ?? "name" const searchFor: string = searchKey.split(";").map(k => inputHelperOptions.feature?.properties[k]?.toLowerCase()) - .find(foundValue => !!foundValue) ?? "" + .find(foundValue => !!foundValue) ?? "" let searchForValue: UIEventSource = new UIEventSource(searchFor) const options: any = args[1] @@ -120,7 +125,7 @@ export default class InputHelpers { value, searchText: searchForValue, instanceOf, - notInstanceOf, + notInstanceOf }) } } diff --git a/src/UI/Map/MapLibreAdaptor.ts b/src/UI/Map/MapLibreAdaptor.ts index c343ebc78..e397e5c2a 100644 --- a/src/UI/Map/MapLibreAdaptor.ts +++ b/src/UI/Map/MapLibreAdaptor.ts @@ -60,6 +60,8 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap { if(!MapLibreAdaptor.pmtilesInited){ maplibregl.addProtocol("pmtiles",new Protocol().tile); MapLibreAdaptor.pmtilesInited = true + console.log("PM-tiles protocol added" + + "") } this._maplibreMap = maplibreMap diff --git a/src/UI/Map/MaplibreMap.svelte b/src/UI/Map/MaplibreMap.svelte index 3425c1756..21cb69fa1 100644 --- a/src/UI/Map/MaplibreMap.svelte +++ b/src/UI/Map/MaplibreMap.svelte @@ -1,13 +1,15 @@
- +
{#if $visualFeedback} diff --git a/src/Utils/pngMapCreator.ts b/src/Utils/pngMapCreator.ts index d0ba245f7..93e54fd0a 100644 --- a/src/Utils/pngMapCreator.ts +++ b/src/Utils/pngMapCreator.ts @@ -67,7 +67,7 @@ export class PngMapCreator { const newZoom = settings.zoom.data + Math.log2(pixelRatio) - 1 const mapElem = new MlMap({ container: div.id, - style: AvailableRasterLayers.maptilerDefaultLayer.properties.url, + style: AvailableRasterLayers.defaultBackgroundLayer.properties.url, center: [l.lon, l.lat], zoom: newZoom, pixelRatio, diff --git a/src/assets/global-raster-layers.json b/src/assets/global-raster-layers.json index bdaacf8a3..81e3d26c7 100644 --- a/src/assets/global-raster-layers.json +++ b/src/assets/global-raster-layers.json @@ -23,6 +23,18 @@ "url": "https://github.com/ZeLonewolf/openstreetmap-americana/" } }, + { + "name": "MapTiler", + "url": "https://api.maptiler.com/maps/15cc8f61-0353-4be6-b8da-13daea5f7432/style.json?key=GvoVAJgu46I5rZapJuAy", + "style": "https://api.maptiler.com/maps/15cc8f61-0353-4be6-b8da-13daea5f7432/style.json?key=GvoVAJgu46I5rZapJuAy", + "category": "osmbasedmap", + "id": "maptiler", + "type": "vector", + "attribution": { + "text": "Maptiler", + "url": "https://www.maptiler.com/copyright/" + } + }, { "name": "MapTiler Carto", "url": "https://api.maptiler.com/maps/openstreetmap/style.json?key=GvoVAJgu46I5rZapJuAy", @@ -168,7 +180,9 @@ { "url": "pmtiles://https://api.protomaps.com/tiles/v3.json?key=2af8b969a9e8b692", "style": "https://api.protomaps.com/styles/v2/white.json?key=2af8b969a9e8b692", - "connect-src": ["https://protomaps.github.io"], + "connect-src": [ + "https://protomaps.github.io" + ], "id": "protomaps.white", "name": "Protomaps White", "type": "vector", @@ -181,7 +195,9 @@ { "url": "pmtiles://https://api.protomaps.com/tiles/v3.json?key=2af8b969a9e8b692", "style": "https://api.protomaps.com/styles/v2/light.json?key=2af8b969a9e8b692", - "connect-src": ["https://protomaps.github.io"], + "connect-src": [ + "https://protomaps.github.io" + ], "id": "protomaps.light", "name": "Protomaps Light", "type": "vector", @@ -193,7 +209,9 @@ }, { "url": "pmtiles://https://api.protomaps.com/tiles/v3.json?key=2af8b969a9e8b692", - "connect-src": ["https://protomaps.github.io"], + "connect-src": [ + "https://protomaps.github.io" + ], "style": "https://api.protomaps.com/styles/v2/grayscale.json?key=2af8b969a9e8b692", "id": "protomaps.grayscale", "name": "Protomaps Grayscale", @@ -206,7 +224,9 @@ }, { "url": "pmtiles://https://api.protomaps.com/tiles/v3.json?key=2af8b969a9e8b692", - "connect-src": ["https://protomaps.github.io"], + "connect-src": [ + "https://protomaps.github.io" + ], "style": "https://api.protomaps.com/styles/v2/dark.json?key=2af8b969a9e8b692", "id": "protomaps.dark", "name": "Protomaps Dark", @@ -220,7 +240,9 @@ { "url": "pmtiles://https://api.protomaps.com/tiles/v3.json?key=2af8b969a9e8b692", "style": "https://api.protomaps.com/styles/v2/black.json?key=2af8b969a9e8b692", - "connect-src": ["https://protomaps.github.io"], + "connect-src": [ + "https://protomaps.github.io" + ], "id": "protomaps.black", "name": "Protomaps Black", "type": "vector", @@ -233,7 +255,9 @@ { "url": "pmtiles://https://api.protomaps.com/tiles/v3.json?key=2af8b969a9e8b692", "style": "assets/sunny.json", - "connect-src": ["https://protomaps.github.io"], + "connect-src": [ + "https://protomaps.github.io" + ], "id": "protomaps.sunny", "name": "Protomaps Sunny", "type": "vector",