Altes Köln

Widget:Karte: Unterschied zwischen den Versionen

Aus Altes Köln
Wechseln zu:Navigation, Suche
(Slider-Tooltip in IE verstecken)
(Slider Border-Radius auch in anderen Browsern anpassen)
Zeile 92: Zeile 92:
height: 11.4px;
height: 11.4px;
border: 1px solid #adb5bd;
border: 1px solid #adb5bd;
border-radius: 4px;
border-radius: 10px;
box-shadow: 0px 3px 12px rgba(0,0,0,0.5);
box-shadow: 0px 3px 12px rgba(0,0,0,0.5);
background: linear-gradient(to right, rgb(255,255,255), #ffc078);
background: linear-gradient(to right, rgb(255,255,255), #ffc078);
Zeile 134: Zeile 134:
height: 11.4px;
height: 11.4px;
border: 1px solid #adb5bd;
border: 1px solid #adb5bd;
border-radius: 4px;
border-radius: 10px;
background: linear-gradient(to right, rgb(255,255,255), #ffc078);
background: linear-gradient(to right, rgb(255,255,255), #ffc078);
box-sizing: border-box;
box-sizing: border-box;

Version vom 18. Mai 2019, 11:05 Uhr

<script type="text/javascript" src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"></script> <link rel="stylesheet" type="text/css" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css">

<style type="text/css"> .ak-map-container { display: flex; }

.ak-map { flex-grow: 1; height: 600px; }

.ak-map-sidebar { box-sizing: border-box; width: 20vw; min-width: 300px; height: 600px; margin: 0 0 0 2em; padding: 1em; border: 1px solid #ced4da; border-radius: 4px; box-shadow: 0px 3px 12px rgba(0,0,0,0.1); overflow-y: auto;

font-family: Arial, sans-serif; color: #495057; }

.ak-map-container fieldset { border: none; padding: 0; margin-bottom: 1.5em; }

.ak-map-container fieldset legend { margin-bottom: 0.75em; padding: 0;

font-weight: 600; }

.ak-map-container label, .ak-map-container input { cursor: pointer; }

.ak-map-layers { list-style: none; margin: 0; padding: 0; }

.ak-map-layers li { border-left-width: 0.5em; border-left-style: solid; padding-left: 0.5em; }

.ak-map-layers li+li { padding-top: 0.5em; }

.ak-map-layer-mittelalter { border-color: #e03131; }

.ak-map-layer-franzoesisch { border-color: #3b5bdb; }

.ak-map-layer-preussisch { border-color: #212529; }

.ak-map-layer-nachkriegszeit { border-color: #adb5bd; }


/* Opacity slider */

input[type=range].ak-map-opacity-slider { -webkit-appearance: none; width: 150px; height: 40px; background: none; }

input[type=range].ak-map-opacity-slider::-webkit-slider-runnable-track { width: 100%; height: 11.4px; border: 1px solid #adb5bd; border-radius: 10px; box-shadow: 0px 3px 12px rgba(0,0,0,0.5); background: linear-gradient(to right, rgb(255,255,255), #ffc078); cursor: pointer; }

input[type=range].ak-map-opacity-slider::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -8.5px; border: 1px solid #adb5bd; border-radius: 15px; box-shadow: 0px 3px 12px rgba(0,0,0,0.5); background: #ffffff; -webkit-appearance: none; cursor: pointer; }

input[type=range].ak-map-opacity-slider::-moz-range-track { width: 100%; height: 11.4px; border: 1px solid #adb5bd; border-radius: 10px; box-shadow: 0px 3px 12px rgba(0,0,0,0.5); background: linear-gradient(to right, rgb(255,255,255), #ffc078); cursor: pointer; }

input[type=range].ak-map-opacity-slider::-moz-range-thumb { width: 26px; height: 26px; border: 1px solid #adb5bd; border-radius: 15px; box-shadow: 0px 3px 12px rgba(0,0,0,0.5); background: #ffffff; cursor: pointer; }

input[type=range].ak-map-opacity-slider::-ms-track { width: 100%; height: 11.4px; border: 1px solid #adb5bd; border-radius: 10px; background: linear-gradient(to right, rgb(255,255,255), #ffc078); box-sizing: border-box; color: transparent; cursor: pointer; }

input[type=range].ak-map-opacity-slider::-ms-thumb { width: 26px; height: 26px; margin-top: 0px; border: 1px solid #adb5bd; border-radius: 15px; box-shadow: none; background: #ffffff; cursor: pointer; }

input[type=range].ak-map-opacity-slider::-ms-fill-lower, input[type=range].ak-map-opacity-slider::-ms-fill-upper { background: transparent; }

input[type=range].ak-map-opacity-slider::-ms-tooltip { display: none; }

</style>

<script type="text/javascript"> (function () {

L.Control.OpacitySlider = L.Control.extend({ options: { position: "topright", initialValue: 1, className: "ak-map-opacity-slider", label: "Transparenz", opacityLayer: undefined },

onAdd: function(map) { var sliderContainerElement = L.DomUtil.create("div");

var sliderElement = L.DomUtil.create("input", this.options.className); sliderElement.setAttribute("type", "range"); sliderElement.setAttribute("min", "0"); sliderElement.setAttribute("max", "1"); sliderElement.setAttribute("step", "0.1"); sliderElement.setAttribute("value", this.options.initialValue); sliderElement.setAttribute("title", this.options.label); sliderElement.setAttribute("aria-label", this.options.label);

L.DomEvent.on(sliderElement, "input", this._setOpacity.bind(this)); // Necessary for IE10/11 support L.DomEvent.on(sliderElement, "change", this._setOpacity.bind(this)); // Prevent dragging of slider handle from moving the map. L.DomEvent.on(sliderElement, "mousedown", function(event) { map.dragging.disable(); }); L.DomEvent.on(sliderElement, "mouseup", function(event) { map.dragging.enable(); });

this._sliderElement = sliderElement; this._opacityLayer = this.options.opacityLayer;

sliderContainerElement.appendChild(sliderElement); return sliderContainerElement; },

_setOpacity: function() { if (this._opacityLayer) { this._opacityLayer.setOpacity(this._sliderElement.value); } },

setOpacityLayer: function(layer) { this._opacityLayer = layer; this._setOpacity(); } });

L.control.opacitySlider = function(opts) { return new L.Control.OpacitySlider(opts); }

function initMap(mapContainerElement) { if (mapContainerElement.dataset.initialised) { return; } mapContainerElement.dataset.initialised = true;

var mapElement = mapContainerElement.getElementsByClassName("ak-map")[0];

var mapView = L.map(mapElement).setView([50.938056, 6.956944], 14);

mapView.on('zoom', function(event) { // For testing purposes and to figure out good min/max zoom levels for new maps. console.log("Zoom:", mapView.getZoom()); });

// Base layers var osmLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }); var dopLayer = L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_dop?', { layers: 'nw_dop_rgb', bounds: [ [52.57192795134163, 9.683550865862706], [50.265130303028236, 5.532200974503678] ], version: '1.3.0', attribution: 'Land NRW (2019), dl-de/by-2-0 (<a href="https://www.govdata.de/dl-de/by-2-0">www.govdata.de/dl-de/by-2-0</a>), <a href="https://www.bezreg-koeln.nrw.de/brk_internet/geobasis/luftbilderzeugnisse/digitale_orthophotos/index.html">Datensatz</a>' });

var eras = { mittelalter: { "class": "ak-map-layer-mittelalter", tooltip: "Mittelalter / Freie Reichsstadt / Hansestadt Köln" }, franzoesisch: { "class": "ak-map-layer-franzoesisch", tooltip: "Französisches Köln" }, preussisch: { "class": "ak-map-layer-preussisch", tooltip: "Preußisches Köln" }, nachkriegszeit: { "class": "ak-map-layer-nachkriegszeit", tooltip: "Kriegs-/Nachkriegszeit bis heute" } };

// Historical maps var maps = [ { id: "merian", label: "1641 Merian", tooltip: "Colonia Agrippina - Cölln, 1641, aus: Topographia Germaniae: 6. Topographia Archiepiscopatuum Moguntinensis, Trevirensis et Coloniensis, hrsg. 1645 von Matthäus Merian", era: eras.mittelalter, layer: L.tileLayer('https://mapwarper.net/maps/tile/39783/{z}/{x}/{y}.png', { attribution: '<a href="https://mapwarper.net/maps/39783">Datensatz</a>' // TODO minZoom/maxZoom }) }, { id: "stockdale", label: "1800 Stockdale", tooltip: "A Plan of the City of Cologne, 1800, John Stockdale", era: eras.franzoesisch, layer: L.tileLayer('https://mapwarper.net/maps/tile/39780/{z}/{x}/{y}.png', { attribution: '<a href="https://mapwarper.net/maps/39780">Datensatz</a>' // TODO minZoom/maxZoom }) }, { id: "tranchot", label: "1801-1828 Tranchot/v. Müffling", tooltip: "1801 - 1828: Kartenaufnahme der Rheinlande 1:25.000; Tranchot/v. Müffling", era: eras.franzoesisch, layer: L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_tranchot?', { layers: 'nw_tranchot', minNativeZoom: 12, minZoom: 10, maxZoom: 16, version: '1.3.0', attribution: 'Land NRW (2019), dl-de/by-2-0 (<a href="https://www.govdata.de/dl-de/by-2-0">www.govdata.de/dl-de/by-2-0</a>), <a href="https://www.bezreg-koeln.nrw.de/brk_internet/geobasis/sonstige/historische_karten/1801/index.html">Datensatz</a>' }) }, { id: "vogt", label: "1815 Vogt/Picquet", tooltip: "Grundriss der Stadt Köln 1815, gezeichnet von Vogt, gestochen von Picquet", era: eras.franzoesisch, layer: L.tileLayer('https://mapwarper.net/maps/tile/39826/{z}/{x}/{y}.png', { attribution: '<a href="https://mapwarper.net/maps/39826">Datensatz</a>' // TODO minZoom/maxZoom }) }, { id: "uraufnahme", label: "1836-1850 Uraufnahme", tooltip: "1836 - 1850: Preußische Kartenaufnahme 1:25.000; Uraufnahme", era: eras.preussisch, layer: L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_uraufnahme?', { layers: 'nw_uraufnahme_gk', minNativeZoom: 14, minZoom: 12, maxZoom: 17, version: '1.3.0', attribution: 'Land NRW (2019), dl-de/by-2-0 (<a href="https://www.govdata.de/dl-de/by-2-0">www.govdata.de/dl-de/by-2-0</a>), <a href="https://www.bezreg-koeln.nrw.de/brk_internet/geobasis/sonstige/historische_karten/1836/index.html">Datensatz</a>' }) }, { id: "neuaufnahme", label: "1891-1912 Neuaufnahme", tooltip: "1891 - 1912: Preußische Kartenaufnahme 1:25.000; Neuaufnahme", era: eras.preussisch, layer: L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_neuaufnahme?', { layers: 'nw_neuaufnahme', minNativeZoom: 12, minZoom: 10, maxZoom: 17, // TODO Do I want to provide a way to turn transparency off for these ones? In addition to having the opacity slider it might be nice to be able to just see the map on its own without the base layer backdrop. transparent: true, // Transparency only works with PNGs. format: 'image/png; mode=8bit', // TODO Figure out how to bound these maps correctly to avoid unnecessary requests. //bounds: [ // [637303, 6.4724e+06], // [1.06105e+06, 6.90972e+06] //], version: '1.3.0', attribution: 'Land NRW (2019), dl-de/by-2-0 (<a href="https://www.govdata.de/dl-de/by-2-0">www.govdata.de/dl-de/by-2-0</a>), <a href="https://www.bezreg-koeln.nrw.de/brk_internet/geobasis/sonstige/historische_karten/1891/index.html">Datensatz</a>' }) }, { id: "meyer", label: "1900 Meyer", tooltip: "Meyers Stadtplan von Köln um 1900", era: eras.preussisch, layer: L.tileLayer('https://mapwarper.net/maps/tile/39790/{z}/{x}/{y}.png', { attribution: '<a href="https://mapwarper.net/maps/39790">Datensatz</a>' // TODO minZoom/maxZoom }) }, { id: "tk25", label: "1936-1945 TK25", tooltip: "Topographische Karten - ältere Auflagejahre", era: eras.nachkriegszeit, layer: L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_tk25_1936-1945?', { layers: 'nw_tk25_1936-1945', minNativeZoom: 15, minZoom: 13, maxZoom: 17, version: '1.3.0', attribution: 'Land NRW (2019), dl-de/by-2-0 (<a href="https://www.govdata.de/dl-de/by-2-0">www.govdata.de/dl-de/by-2-0</a>), <a href="https://www.bezreg-koeln.nrw.de/brk_internet/geobasis/sonstige/topographische_karten_aeltere/index.html">Datensatz</a>' }) }, { id: "hop", label: "1988-1994 Historische Orthophotos", tooltip: "1988-1994 Historische Orthophotos", era: eras.nachkriegszeit, layer: L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_histortho_1988-1994?', { layers: 'nw_histortho_1988-1994', minNativeZoom: 15, minZoom: 13, maxZoom: 18, version: '1.3.0', attribution: 'Land NRW (2019), dl-de/by-2-0 (<a href="https://www.govdata.de/dl-de/by-2-0">www.govdata.de/dl-de/by-2-0</a>), <a href="https://www.bezreg-koeln.nrw.de/brk_internet/geobasis/luftbilderzeugnisse/altere_orthophotos/index.html">Datensatz</a>' }) }, { id: "dgk", label: "-2016 Deutsche Grundkarte", tooltip: "Deutsche Grundkarte 1:5.000 (DGK5) – historisch", era: eras.nachkriegszeit, layer: L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_dgk5?', { layers: 'nw_dgk5_grundriss', minNativeZoom: 16, minZoom: 13, maxZoom: 18, transparent: true, // Transparency only works with PNGs. format: 'image/png; mode=8bit', version: '1.3.0', attribution: 'Land NRW (2019), dl-de/by-2-0 (<a href="https://www.govdata.de/dl-de/by-2-0">www.govdata.de/dl-de/by-2-0</a>), <a href="https://www.bezreg-koeln.nrw.de/brk_internet/geobasis/sonstige/deutsche_grundkarte/index.html">Datensatz</a>' }) } ];

// TODO Find a way to display the attribution of the layers more clearly. "|" as a separator instead of ",".

// Keeping track of selected layers. Set initially selected ones. var currentMap = maps[0]; var currentBaseLayer = osmLayer;

// Switching between base layers function baseMapSwitcher() { if (this.checked) { currentBaseLayer.remove(); if (this.value === "osm") { currentBaseLayer = osmLayer; } else { currentBaseLayer = dopLayer; } // TODO Funktioniert nicht. currentBaseLayer.options.minZoom = currentMap.layer.minZoom; currentBaseLayer.options.maxZoom = currentMap.layer.maxZoom; currentBaseLayer.addTo(mapView); currentBaseLayer.bringToBack(); } } mapContainerElement.querySelector(".ak-base-map-selection--osm").addEventListener("change", baseMapSwitcher); mapContainerElement.querySelector(".ak-base-map-selection--dop").addEventListener("change", baseMapSwitcher);

// Setting opacity var opacitySliderControl = L.control.opacitySlider({ opacityLayer: currentMap.layer }).addTo(mapView);

// Render radio buttons for historical map switching. var layersListElement = mapContainerElement.querySelector(".ak-map-layers"); maps.forEach(function(map) { var listItemElement = L.DomUtil.create("li", map.era["class"]); listItemElement.setAttribute("title", map.era.tooltip); layersListElement.appendChild(listItemElement); var labelElement = L.DomUtil.create("label"); labelElement.setAttribute("title", map.tooltip); listItemElement.appendChild(labelElement); var inputElement = L.DomUtil.create("input"); inputElement.setAttribute("type", "radio"); inputElement.setAttribute("name", "ak-map-layer-selection"); inputElement.setAttribute("value", map.id); labelElement.appendChild(inputElement); labelElement.appendChild(document.createTextNode(map.label));

if (map === currentMap) { inputElement.checked = true; }

inputElement.addEventListener("change", function() { if (inputElement.checked) { currentMap.layer.remove(); currentMap = map; opacitySliderControl.setOpacityLayer(currentMap.layer); currentMap.layer.addTo(mapView); // TODO check zoom range and bounds of map, adjust mapView accordingly. } }); });

// Show layers. currentBaseLayer.addTo(mapView); currentMap.layer.addTo(mapView); }

// Initialise all found maps when DOM is ready. document.addEventListener("DOMContentLoaded", function(event) { var mapContainerElements = document.getElementsByClassName("ak-map-container"); for(var i = 0; i < mapContainerElements.length; i++) { initMap(mapContainerElements.item(i)); } }); })(); </script>

<form class="ak-map-sidebar" autocomplete="off"> <fieldset> <legend>Basiskarte</legend> <label><input type="radio" class="ak-base-map-selection--osm" name="ak-base-map-selection" value="osm" checked>OpenStreetMap</label> <label><input type="radio" class="ak-base-map-selection--dop" name="ak-base-map-selection" value="dop">Digitale Orthophotos</label> </fieldset> <fieldset> <legend>Historische Karten</legend>

</fieldset> </form>

Cookies helfen uns bei der Bereitstellung von Altes Köln. Durch die Nutzung von Altes Köln erklärst du dich damit einverstanden, dass wir Cookies speichern.