Fix: add correct attribution for maptiler bg layer

This commit is contained in:
Pieter Vander Vennet 2023-05-18 15:56:24 +02:00
parent 82093ffdf4
commit c90b334678
3 changed files with 25 additions and 10 deletions

View file

@ -39,6 +39,9 @@ export default class BackgroundLayerResetter {
availableLayers,
currentBgPolygon?.properties?.category
)
if(!availableInSameCat){
return
}
console.log("Selecting a different layer:", availableInSameCat.properties.id)
currentBackgroundLayer.setData(availableInSameCat)
})

View file

@ -1,10 +1,10 @@
import { Feature, Polygon } from "geojson"
import {Feature, Polygon} from "geojson"
import * as editorlayerindex from "../assets/editor-layer-index.json"
import * as globallayers from "../assets/global-raster-layers.json"
import { BBox } from "../Logic/BBox"
import { Store, Stores } from "../Logic/UIEventSource"
import { GeoOperations } from "../Logic/GeoOperations"
import { RasterLayerProperties } from "./RasterLayerProperties"
import {BBox} from "../Logic/BBox"
import {Store, Stores} from "../Logic/UIEventSource"
import {GeoOperations} from "../Logic/GeoOperations"
import {RasterLayerProperties} from "./RasterLayerProperties"
export class AvailableRasterLayers {
public static EditorLayerIndex: (Feature<Polygon, EditorLayerIndexProperties> &
@ -39,9 +39,15 @@ export class AvailableRasterLayers {
public static readonly maplibre: RasterLayerPolygon = {
type: "Feature",
properties: <any>{
name: "MapLibre",
properties: {
name: "MapTiler",
url: null,
category: "osmbasedmap",
id: "maptiler",
attribution: {
text: "Maptiler",
url: "https://www.maptiler.com/copyright/"
}
},
geometry: BBox.global.asGeometry(),
}

View file

@ -1,5 +1,5 @@
<script lang="ts">
import {UIEventSource} from "../Logic/UIEventSource";
import {Store, UIEventSource} from "../Logic/UIEventSource";
import {Map as MlMap} from "maplibre-gl";
import MaplibreMap from "./Map/MaplibreMap.svelte";
import FeatureSwitchState from "../Logic/State/FeatureSwitchState";
@ -46,6 +46,8 @@
import RasterLayerPicker from "./Map/RasterLayerPicker.svelte";
import RasterLayerOverview from "./Map/RasterLayerOverview.svelte";
import IfHidden from "./Base/IfHidden.svelte";
import {onDestroy} from "svelte";
import {AvailableRasterLayers} from "../Models/RasterLayers";
export let state: ThemeViewState;
let layout = state.layout;
@ -90,7 +92,11 @@
let availableLayers = state.availableLayers;
let userdetails = state.osmConnection.userDetails;
let currentViewLayer = layout.layers.find(l => l.id === "current_view")
let rasterLayer: Readable<RasterLayerPolygon> = state.mapProperties.rasterLayer
let rasterLayer: Store<RasterLayerPolygon> = state.mapProperties.rasterLayer
let rasterLayerName = rasterLayer.data?.properties?.name ?? AvailableRasterLayers.maplibre.properties.name
onDestroy(rasterLayer.addCallbackAndRunD(l => {
rasterLayerName = l.properties.name
}))
</script>
@ -144,7 +150,7 @@
</MapControlButton>
<a class="opacity-50 hover:opacity-100 text-white cursor-pointer bg-black-transparent px-1 rounded-2xl"
on:click={() =>{ state.guistate.themeViewTab.setData("copyright"); state.guistate.themeIsOpened.setData(true)}}>
© OpenStreetMap | <span class="w-24">{$rasterLayer.properties.name}</span>
© OpenStreetMap | <span class="w-24">{rasterLayerName}</span>
</a>
</div>