From 54c92bd34a739f0f1f35a1a753dfb712d5d2c7cf Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 22 Jul 2020 14:46:43 +0200 Subject: [PATCH] Removed old select layer button --- Logic/Basemap.ts | 102 ++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 54 deletions(-) diff --git a/Logic/Basemap.ts b/Logic/Basemap.ts index ebdfe98d4..750196a4d 100644 --- a/Logic/Basemap.ts +++ b/Logic/Basemap.ts @@ -2,60 +2,61 @@ import L from "leaflet" import {UIEventSource} from "../UI/UIEventSource"; import {UIElement} from "../UI/UIElement"; + +export class BaseLayers { + + public static readonly defaultLayerName = "Kaart van OpenStreetMap"; + public static readonly baseLayers = { + ["Luchtfoto Vlaanderen (recentste door AIV)"]: + L.tileLayer("https://tile.informatievlaanderen.be/ws/raadpleegdiensten/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&" + + "LAYER=omwrgbmrvl&STYLE=&FORMAT=image/png&tileMatrixSet=GoogleMapsVL&tileMatrix={z}&tileRow={y}&tileCol={x}", + { + // omwrgbmrvl + attribution: 'Luchtfoto\'s van © AIV Vlaanderen (Laatste) © AGIV', + maxZoom: 20, + minZoom: 1, + wmts: true + }), + ["Luchtfoto Vlaanderen (2013-2015, door AIV)"]: L.tileLayer.wms('https://geoservices.informatievlaanderen.be/raadpleegdiensten/OGW/wms?s', + { + layers: "OGWRGB13_15VL", + attribution: "Luchtfoto's van © AIV Vlaanderen (2013-2015) | " + }), + [BaseLayers.defaultLayerName]: L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", + { + attribution: '', + maxZoom: 19, + minZoom: 1 + }), + ["Kaart Grootschalig ReferentieBestand Vlaanderen (GRB) door AIV"]: L.tileLayer("https://tile.informatievlaanderen.be/ws/raadpleegdiensten/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=grb_bsk&STYLE=&FORMAT=image/png&tileMatrixSet=GoogleMapsVL&tileMatrix={z}&tileCol={x}&tileRow={y}", + { + attribution: 'Achtergrond Grootschalig ReferentieBestand(GRB) © AGIV', + maxZoom: 20, + minZoom: 1, + wmts: true + }), + }; + + public static readonly defaultLayer = BaseLayers.baseLayers[BaseLayers.defaultLayerName]; + +} + // Contains all setup and baselayers for Leaflet stuff export class Basemap { + // @ts-ignore public map: Map; public Location: UIEventSource<{ zoom: number, lat: number, lon: number }>; - public LastClickLocation: UIEventSource<{ lat: number, lon: number }> = new UIEventSource<{lat: number, lon: number}>(undefined) + public LastClickLocation: UIEventSource<{ lat: number, lon: number }> = new UIEventSource<{ lat: number, lon: number }>(undefined) + public CurrentLayer: UIEventSource<{ + name: string, + layer: L.tileLayer + }> = new UIEventSource( + {name: BaseLayers.defaultLayerName, layer: BaseLayers.defaultLayer} + ); - private aivLucht2013Layer = L.tileLayer.wms('https://geoservices.informatievlaanderen.be/raadpleegdiensten/OGW/wms?s', - { - layers: "OGWRGB13_15VL", - attribution: "Luchtfoto's van © AIV Vlaanderen (2013-2015) | " - }); - - private aivLuchtLatestLayer = L.tileLayer("https://tile.informatievlaanderen.be/ws/raadpleegdiensten/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&" + - "LAYER=omwrgbmrvl&STYLE=&FORMAT=image/png&tileMatrixSet=GoogleMapsVL&tileMatrix={z}&tileRow={y}&tileCol={x}", - { - // omwrgbmrvl - attribution: 'Luchtfoto\'s van © AIV Vlaanderen (Laatste) © AGIV', - maxZoom: 20, - minZoom: 1, - wmts: true - }); - - - private osmLayer = L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", - { - attribution: '', - maxZoom: 19, - minZoom: 1 - }); - private osmBeLayer = L.tileLayer("https://tile.osm.be/osmbe/{z}/{x}/{y}.png", - { - attribution: 'Tile hosting courtesy of Geo6', - maxZoom: 18, - minZoom: 1 - }); - - private grbLayer = L.tileLayer("https://tile.informatievlaanderen.be/ws/raadpleegdiensten/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=grb_bsk&STYLE=&FORMAT=image/png&tileMatrixSet=GoogleMapsVL&tileMatrix={z}&tileCol={x}&tileRow={y}", - { - attribution: 'Achtergrond Grootschalig ReferentieBestand(GRB) © AGIV', - maxZoom: 20, - minZoom: 1, - wmts: true - }); - - - private baseLayers = { - "Luchtfoto Vlaanderen (recentste door AIV)": this.aivLuchtLatestLayer, - "Luchtfoto Vlaanderen (2013-2015, door AIV)": this.aivLucht2013Layer, - "Kaart van OpenStreetMap": this.osmLayer, - "Kaart Grootschalig ReferentieBestand Vlaanderen (GRB) door AIV": this.grbLayer - }; constructor(leafletElementId: string, location: UIEventSource<{ zoom: number, lat: number, lon: number }>, @@ -63,19 +64,12 @@ export class Basemap { this.map = L.map(leafletElementId, { center: [location.data.lat, location.data.lon], zoom: location.data.zoom, - layers: [this.osmLayer], + layers: [BaseLayers.defaultLayer], }); this.map.attributionControl.setPrefix( extraAttribution.Render() + " | OpenStreetMap"); this.Location = location; - const layerControl = L.control.layers(this.baseLayers, null, - { - position: 'bottomright', - hideSingleBase: true - }) - layerControl.addTo(this.map); - this.map.zoomControl.setPosition("bottomright"); const self = this;