Altes Köln

Widget:Karte: Unterschied zwischen den Versionen

Aus Altes Köln
Wechseln zu:Navigation, Suche
Keine Bearbeitungszusammenfassung
(Links von Zeiträume Köln nochmal angepasst)
Markierung: 2017-Quelltext-Bearbeitung
 
(53 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
<script type="text/javascript" src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"></script>
<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">
<link rel="stylesheet" type="text/css" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css">
<!-- TODO rawgithub service is deprecated. host these ourselves? -->
<script type="text/javascript" src="https://rawgithub.com/mylen/leaflet.TileLayer.WMTS/master/leaflet-tilelayer-wmts.js"></script>
<script type="text/javascript" src="https://rawgithub.com/kartena/Proj4Leaflet/master/lib/proj4-compressed.js"></script>
<script type="text/javascript" src="https://rawgithub.com/kartena/Proj4Leaflet/master/src/proj4leaflet.js"></script>


<style type="text/css">
<style type="text/css">
.ak-map-container {
display: flex;
}
.ak-map {
.ak-map {
    width: 100%;
flex-grow: 1;
    height: 600px;
height: 600px;
}
 
.ak-map-sidebar {
box-sizing: border-box;
width: 20vw;
min-width: 300px;
height: 600px;
padding: 2em;
overflow-y: auto;
 
font-family: Arial, sans-serif;
font-size: 16px;
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;
font-size: 16px;
}
 
.ak-map-container label,
.ak-map-container input {
cursor: pointer;
}
 
.ak-map-container label {
margin-bottom: 0;
}
 
.ak-map-container input {
margin-left: 0;
margin-right: 0.5em;
}
 
.ak-map-layers,
.ak-map-basemaps {
list-style: none;
margin: 0;
padding: 0;
}
 
.ak-map-basemaps {
display: flex;
}
 
.ak-map-basemaps li+li {
margin-left: 1em;
}
 
.ak-map-layers li {
display: flex;
align-items: center;
margin-bottom: 0;
border-left-width: 0.5em;
border-left-style: solid;
padding-left: 0.5em;
}
 
.ak-map-layers li+li {
padding-top: 0.5em;
}
 
.ak-map-layers li label+a {
display: inline-block;
width: 16px;
height: 16px;
margin-left: 1em;
/* Info icon taken from https://feathericons.com/ */
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2374c0fc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12' y2='8'%3E%3C/line%3E%3C/svg%3E");
}
 
.ak-map-layers li label+a:hover {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23339af0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12' y2='8'%3E%3C/line%3E%3C/svg%3E");
}
 
.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;
}
 
.ak-map-links {
margin: 0;
padding-left: 15px;
list-style-image: none;
}
 
.ak-map-links li + li {
padding-top: 8px;
}
 
 
/* Metadata container that may be added by the wiki page to hand more information over to the map. */
.ak-map-metadata {
display: none;
}
}
/* 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>
</style>


Zeile 16: Zeile 214:
(function () {
(function () {


function initMap(mapElement) {
L.Control.OpacitySlider = L.Control.extend({
if (mapElement.dataset.initialised) {
options: {
position: "topright",
initialValue: 0.7,
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.setOpacityLayer(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, metadata, baseLayerToShow, historicalLayerToShow, geoJsonDataLayerUrl, poiDataLayerUrl) {
if (mapContainerElement.dataset.initialised) {
return;
return;
}
}
mapElement.dataset.initialised = true;
mapContainerElement.dataset.initialised = true;


var map = L.map(mapElement).setView([50.938056, 6.956944], 14);
var mapElement = mapContainerElement.getElementsByClassName("ak-map")[0];


map.on('zoom', function(event) {
var mapView = L.map(mapElement, {
console.log("Zoom:", map.getZoom());
// Bounding box for Köln (<https://www.openstreetmap.org/relation/62578>).
maxBounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
}).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.de/tiles/osmde/{z}/{x}/{y}.png', {
minZoom: 6,
maxZoom: 18,
attribution: '&copy; <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',
minZoom: 6,
maxZoom: 18,
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 baseMaps = {};
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: "Nachkriegszeit bis heute"
}
};


baseMaps['<span title="Colonia Agrippina - Cölln, 1641, aus: Topographia Germaniae: 6. Topographia Archiepiscopatuum Moguntinensis, Trevirensis et Coloniensis, hrsg. 1645 von Matthäus Merian">1641 Merian</span>'] = L.tileLayer('https://mapwarper.net/maps/tile/39783/{z}/{x}/{y}.png', {
// Historical maps
attribution: '<a href="https://mapwarper.net/maps/39783">Datensatz</a>'
var maps = [
});
{
id: "mercator",
label: "1571 Mercator",
tooltip: "Mercatorplan von Köln, auch bekannt als Kölner Stadtansicht von 1570/1571, Arnold Mercator",
era: eras.mittelalter,
layer: L.tileLayer('https://mapwarper.net/maps/tile/40952/{z}/{x}/{y}.png', {
minZoom: 6,
maxZoom: 18,
// TODO Restrict bounds even further.
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
attribution: '<a href="https://mapwarper.net/maps/40952">Georeferenzierte Datei</a>, <a href="http://www.deutschefotothek.de/documents/obj/70305086">Originaldatei © SLUB / Deutsche Fotothek</a>, <a href="https://creativecommons.org/licenses/by-sa/4.0/">cc-by-sa</a>'
})
},
{
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', {
minZoom: 6,
maxZoom: 17,
// TODO Restrict bounds even further.
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
attribution: '<a href="https://mapwarper.net/maps/39783">Georeferenzierte Datei</a>'
})
},
{
id: "reinhardt",
label: "1752 Reinhardt",
tooltip: "Kölner Stadtplan von 1752, Johann Valentin Reinhardt",
era: eras.mittelalter,
layer: L.tileLayer('https://mapwarper.net/maps/tile/41691/{z}/{x}/{y}.png', {
minZoom: 6,
maxZoom: 18,
// TODO Restrict bounds even further.
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
attribution: '<a href="https://mapwarper.net/maps/41691">Georeferenzierte Datei</a>'
})
},
{
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', {
minZoom: 6,
maxZoom: 17,
// TODO Restrict bounds even further.
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
attribution: '<a href="https://mapwarper.net/maps/39780">Georeferenzierte Datei</a>'
})
},
{
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,
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
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', {
minZoom: 6,
maxZoom: 18,
// TODO Restrict bounds even further.
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
attribution: '<a href="https://mapwarper.net/maps/39826">Georeferenzierte Datei</a>'
})
},
{
id: "festungsplan",
label: "1815-1918 Festungsplan",
tooltip: "Standorte von militärischen Bauwerken und Anlagen in den Jahren 1815-1918",
era: eras.preussisch,
layer: L.tileLayer('https://mapwarper.net/maps/tile/56436/{z}/{x}/{y}.png', {
minZoom: 6,
maxZoom: 18,
// TODO Restrict bounds even further.
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
attribution: '<a href="https://mapwarper.net/maps/56436">Georeferenzierte Datei</a>'
})
},
{
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_rw',
minNativeZoom: 14,
minZoom: 12,
maxZoom: 17,
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
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,
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
// 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',
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', {
minZoom: 6,
maxZoom: 17,
// TODO Restrict bounds even further.
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
attribution: '<a href="https://mapwarper.net/maps/39790">Georeferenzierte Datei</a>'
})
},
{
id: "tk25",
label: "1936-1945 TK25",
tooltip: "Topographische Karten - ältere Auflagejahre",
era: eras.preussisch,
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,
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
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,
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
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,
bounds: [
[50.8304494, 6.7725303],
[51.0849743, 7.1620280]
],
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 ",".
 
var baseLayerOsmElement = mapContainerElement.querySelector(".ak-base-map-selection--osm");
var baseLayerDopElement = mapContainerElement.querySelector(".ak-base-map-selection--dop");
 
// Keeping track of selected layers. Set initially selected ones.
var currentHistLayer = maps[0];
var currentBaseLayer = osmLayer;
if (baseLayerToShow) {
if (baseLayerToShow === "osm") {
currentBaseLayer = osmLayer;
} else if (baseLayerToShow === "dop") {
currentBaseLayer = dopLayer;
baseLayerDopElement.checked = true;
}
}
if (historicalLayerToShow) {
for (var i = 0; i < maps.length; i++) {
if (maps[i].id === historicalLayerToShow) {
currentHistLayer = maps[i];
break;
}
}
}
 
// Switching between base layers
function baseLayerSwitcher() {
if (this.checked) {
currentBaseLayer.remove();
if (this.value === "osm") {
currentBaseLayer = osmLayer;
} else {
currentBaseLayer = dopLayer;
}
// TODO Funktioniert nicht.
currentBaseLayer.options.minZoom = currentHistLayer.layer.minZoom;
currentBaseLayer.options.maxZoom = currentHistLayer.layer.maxZoom;
currentBaseLayer.addTo(mapView);
currentBaseLayer.bringToBack();
}
}
baseLayerOsmElement.addEventListener("change", baseLayerSwitcher);
baseLayerDopElement.addEventListener("change", baseLayerSwitcher);
 
// Setting opacity
var opacitySliderControl = L.control.opacitySlider({ opacityLayer: currentHistLayer.layer }).addTo(mapView);


baseMaps['<span title="A Plan of the City of Cologne, 1800, John Stockdale">1800 Stockdale</span>'] = L.tileLayer('https://mapwarper.net/maps/tile/39780/{z}/{x}/{y}.png', {
// Render radio buttons for historical map switching.
attribution: '<a href="https://mapwarper.net/maps/39780">Datensatz</a>'
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));


baseMaps['<span title="1801 - 1828: Kartenaufnahme der Rheinlande 1:25.000; Tranchot/v. Müffling">1801-1828 Tranchot/v. Müffling</span>'] = L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_tranchot?', {
if (map === currentHistLayer) {
layers: 'nw_tranchot',
inputElement.checked = true;
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>'
}).addTo(map);


baseMaps['<span title="Grundriss der Stadt Köln 1815, gezeichnet von Vogt, gestochen von Picquet">1815 Vogt/Picquet</span>'] = L.tileLayer('https://mapwarper.net/maps/tile/39826/{z}/{x}/{y}.png', {
inputElement.addEventListener("change", function() {
attribution: '<a href="https://mapwarper.net/maps/39826">Datensatz</a>'
if (inputElement.checked) {
});
currentHistLayer.layer.remove();
currentHistLayer = map;
opacitySliderControl.setOpacityLayer(currentHistLayer.layer);
currentHistLayer.layer.addTo(mapView);
// TODO check zoom range and bounds of map, adjust mapView accordingly.
}
});


baseMaps['<span title="1836 - 1850: Preußische Kartenaufnahme 1:25.000; Uraufnahme">1836-1850 Uraufnahme</span>'] = L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_uraufnahme?', {
var mapPageUrl = metadata[map.id];
layers: 'nw_uraufnahme_gk',
if (mapPageUrl) {
minNativeZoom: 14,
var pageLinkElement = L.DomUtil.create("a");
minZoom: 12,
pageLinkElement.href = mapPageUrl;
maxZoom: 17,
pageLinkElement.setAttribute("title", "Zur Kartenseite");
version: '1.3.0',
pageLinkElement.setAttribute("aria-label", "Zur Kartenseite");
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>'
listItemElement.appendChild(pageLinkElement);
}
});
});


// Nur für die Gegend um Detmold vorhanden.
// Show layers.
/*baseMaps['<span title="1881 - 1883: Karten des Fürstenthums Lippe 1:25.000">1881-1883 Lippe</span>'] = L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_lippe?', {
currentBaseLayer.addTo(mapView);
layers: 'nw_lippe',
currentHistLayer.layer.addTo(mapView);
minZoom: 12,
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/1881/index.html">Datensatz</a>'
});*/


baseMaps['<span title="1891 - 1912: Preußische Kartenaufnahme 1:25.000; Neuaufnahme">1891-1912 Neuaufnahme</span>'] = L.layerGroup([
// Load data layer if provided.
// Since this map works well with transparency, we can put OSM below it as a base layer.
if (geoJsonDataLayerUrl) {
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
loadJson(geoJsonDataLayerUrl, function(data) {
minZoom: 10,
var options = {
maxZoom: 17,
// TODO add tooltips/markers/styles etc. from data using onEachFeature/style function options, implementing <https://github.com/mapbox/simplestyle-spec/tree/master/1.1.0>.
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
// see <https://leafletjs.com/reference-1.5.0.html#geojson>.
}),
style: function(geoJsonFeature) {
L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_neuaufnahme?', {
return {
layers: 'nw_neuaufnahme',
interactive: false
minNativeZoom: 12,
};
minZoom: 10,
}
maxZoom: 17,
};
transparent: true,
if (data.attributionText && data.attributionUrl) {
// Transparency only works with PNGs.
// Create as DOM node and then convert back to text to escape attribution content and prevent XSS attacks.
format: 'image/png; mode=8bit',
var attributionLinkElement = L.DomUtil.create("a");
// TODO Figure out how to bound these maps correctly to avoid unnecessary requests.
attributionLinkElement.href = data.attributionUrl;
//bounds: [
attributionLinkElement.appendChild(document.createTextNode(data.attributionText));
// [637303, 6.4724e+06],
options.attribution = attributionLinkElement.outerHTML;
//  [1.06105e+06, 6.90972e+06]
}
//],
var dataLayer = L.geoJSON(data, options);
version: '1.3.0',
dataLayer.addTo(mapView);
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>'
// Set view and zoom around shapes being shown.
})
// TODO Might want to introduce some padding later. But consider <https://stackoverflow.com/a/55173276>.
]);
// TODO This does a really visible zoom out / movement which might be nauseating. Maybe we can load the data earlier (in parallel to waiting for DOMContentLoaded) and only render the map once it is available (with a timeout).
mapView.fitBounds(dataLayer.getBounds());
}, function() {
mapView.openPopup("Die Daten für das anzuzeigende Objekt konnten leider nicht geladen werden. 🙁", mapView.getCenter());
});
}


baseMaps['<span title="Meyers Stadtplan von Köln um 1900">1900 Meyer</span>'] = L.tileLayer('https://mapwarper.net/maps/tile/39790/{z}/{x}/{y}.png', {
if (poiDataLayerUrl) {
attribution: '<a href="https://mapwarper.net/maps/39790">Datensatz</a>'
loadJson(poiDataLayerUrl, function(response) {
var data = convertSmwResultToGeoJson(response);
var options = {
pointToLayer: function(geoJsonPoint, latlng) {
var options = {
riseOnHover: true
};
if (geoJsonPoint.properties && geoJsonPoint.properties.title) {
options.title = geoJsonPoint.properties.title;
}
return L.marker(latlng, options);
},
onEachFeature: function(feature, layer) {
if (feature.properties && (feature.properties.description || feature.properties.url || feature.properties.pictureUrl)) {
var popupContent = "";
if (feature.properties.title) {
if (feature.properties.url) {
popupContent += "<h3><a href=\"" + feature.properties.url + "\">" + feature.properties.title + "</a></h3>";
} else {
popupContent += "<h3>" + feature.properties.title + "</h3>";
}
}
if (feature.properties.description) {
popupContent += "<p>" + feature.properties.description + "</p>";
}
if (feature.properties.pictureUrl) {
popupContent += "<p><img src=\"" + feature.properties.pictureUrl + "\" /></p>";
}
if (feature.properties.url && !feature.properties.title) {
popupContent += "<p><a href=\"" + feature.properties.url + "\">Seite besuchen</a></p>";
}
layer.bindPopup(popupContent);
}
}
};
var dataLayer = L.geoJSON(data, options);
dataLayer.addTo(mapView);
}, function() {
mapView.openPopup("Die anzuzeigenden Daten konnten leider nicht geladen werden. 🙁", mapView.getCenter());
});
}
}
 
function convertSmwResultToGeoJson(response) {
var results = response.query.results;
var geoJson = {
"type": "FeatureCollection",
"features": []
};
geoJson.features = results.map(function(result) {
// For some reason the actual semantic object is in a property in the result object, with the key being the id of the object.
// Since we don't know the id in advance we have to fetch it as the first (and hopefully only) key of the object.
var object = result[Object.keys(result)[0]];
// Can't handle results without coordinates, so skip this one.
if (typeof object.printouts.Position === "undefined" || object.printouts.Position.length === 0) {
return null;
}
var feature = {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [object.printouts.Position[0].lon, object.printouts.Position[0].lat]
},
"properties": {}
};
if (typeof object.printouts.Name !== "undefined" && object.printouts.Name.length) {
feature.properties.title = object.printouts.Name[0];
}
if (typeof object.printouts.Kurzbeschreibung !== "undefined" && object.printouts.Kurzbeschreibung.length) {
feature.properties.description = object.printouts.Kurzbeschreibung[0];
}
if (typeof object.printouts["Siehe auch"] !== "undefined" && object.printouts["Siehe auch"].length) {
feature.properties.url = object.printouts["Siehe auch"][0];
}
if (typeof object.printouts.Bild !== "undefined" && object.printouts.Bild.length) {
feature.properties.pictureUrl = object.printouts.Bild[0];
}
return feature;
}).filter(function(e) {
// Since we might have skipped some invalid results by returning null, we need to filter them out.
return e != null;
});
});
return geoJson;
}


baseMaps['<span title="Topographische Karten - ältere Auflagejahre">1936-1945 TK25</span>'] = L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_tk25_1936-1945?', {
function parseMetadata(metadataElements) {
layers: 'nw_tk25_1936-1945',
var metadata = {};
minNativeZoom: 15,
for (var i = 0; i < metadataElements.length; i++) {
minZoom: 13,
var element = metadataElements.item(i);
maxZoom: 17,
var queryRowElements = element.querySelectorAll(".smw-format.ul-format .smw-row");
version: '1.3.0',
forEachElement(queryRowElements, function(row) {
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>'
var anchorElement = row.querySelector(".smw-field:first-child .smw-value a");
});
var url = anchorElement.href;
var idValueElement = row.querySelector(".smw-field:last-child .smw-value");
var id = idValueElement.textContent;
metadata[id] = url;
});
}
return metadata;
}


baseMaps['<span title="Deutsche Grundkarte 1:5.000 (DGK5) – historisch">-2016 Deutsche Grundkarte</span>'] = L.layerGroup([
function forEachElement(nodeList, callback) {
// Since this map works well with transparency, we can put OSM below it as a base layer. The only downside is that you see duplicate layers, in some cases on top of each other which makes them harder to read.
if (nodeList.forEach) {
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
nodeList.forEach(callback);
minZoom: 13,
} else {
maxZoom: 18,
Array.prototype.forEach.call(nodeList, callback);
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}
}),
}
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>'
})
]);


baseMaps['1988-1994 Historische Orthophotos'] = L.layerGroup([
var getQueryParameter = (function() {
L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_histortho_1988-1994?', {
var query = window.location.search.substring(1);
layers: 'nw_histortho_1988-1994',
var params = query.split("&");
minNativeZoom: 15,
params = params.map(function(param) {
minZoom: 13,
var pair = param.split("=");
maxZoom: 18,
pair[0] = decodeURIComponent(pair[0]);
version: '1.3.0',
if (pair.length > 1) {
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>'
pair[1] = decodeURIComponent(pair[1]);
}),
}
// Add an overlay to show streets etc.
return pair;
// This overlay was made for the current photos. This is not ideal since it can show roads that didn't exist at the time the photos were taken but it's probably still more helpful than it is confusing.
});
L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_dop_overlay?', {
return function(parameterName) {
// TODO These layers don't work very well in a WMS because it's not meant to be displayed as tiles so labels are cut off at the tile borders or appear too many times (lots of tiles being displayed). Ideally we'd load this via WMTS.
for (var i = 0; i < params.length; i++) {
layers: 'nw_dop_overlay_Stadt-Bahn-Haltestellen,nw_dop_overlay_Bahnhoefe,nw_dop_overlay_geonamen,nw_dop_overlay_autobahn,nw_dop_overlay_autobahn_beschriftung_1,nw_dop_overlay_autobahn_beschriftung_2,nw_dop_overlay_bundesstrassen,nw_dop_overlay_bundesstrassen_beschriftung_1,nw_dop_overlay_bundesstrassen_beschriftung_2,nw_dop_overlay_landstrassen,nw_dop_overlay_landstrassen_beschriftung,nw_dop_overlay_kreisstrassen,nw_dop_overlay_kreisstrassen_beschriftung,nw_dop_overlay_ortsstrassen,nw_dop_overlay_ortsstrassen_beschriftung,nw_dop_overlay_unbefahrbare_wege,nw_dop_overlay_strassen_bau,nw_dop_overlay_bab_anschlussstellen,nw_dop_overlay_gem_namen,nw_dop_overlay_krs_namen,nw_dop_overlay_faehren',
if (params[i][0] === parameterName) {
// nw_dop_overlay_hausnummern, // TODO Layer not available in coordinate systems supported natively by Leaflet.
if (params[i].length > 1) {
minZoom: 13,
return params[i][1];
maxZoom: 18,
}
bounds: [
return "";
[52.57192795134163, 9.683550865862706],
}
[50.265130303028236, 5.532200974503678]
}
],
return undefined;
// Since this is an overlay it doesn't make much sense without transparency.
};
transparent: true,
})();
// Transparency only works with PNGs.
format: 'image/png; mode=8bit',
version: '1.3.0'
})
]);


// Funktioniert nicht (liefert nur weiße Tiles).
function loadJson(url, onSuccess, onFailure) {
/*baseMaps['1996-2015 Historische Orthophotos'] = L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_hist_dop?', {
var request = new XMLHttpRequest();
layers: 'nw_hist_dop_2015',
request.open("GET", url, true);
//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>'
});*/


// Funktioniert nicht, ich werde auf die Capabilities-XML weitergeleitet. Ich nehme an, der Service unterstützt GetTile nicht, sondern nur Ressourcen-URLs.
request.onload = function() {
/*baseMaps['Digitale Orthophotos'] = L.tileLayer.wmts('https://www.wmts.nrw.de/geobasis/wmts_nw_dop', {
if (request.status >= 200 && request.status < 400) {
layer: 'nw_dop',
var data;
format: 'image/png',
try {
style: 'normal',
data = JSON.parse(request.responseText);
tilematrixSet: 'EPSG_3857_16'
} catch(error) {
//minNativeZoom: 15,
callSafely(onFailure, error);
//minZoom: 13,
return;
//maxZoom: 18,
}
//version: '1.0.0',
callSafely(onSuccess, data);
// Die WMTS-Library schickt die attribution als Parameter weiter an den Service. Nicht toll.
} else {
//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>'
callSafely(onFailure);
});*/
}
};


// Liefert mir Server Errors mit EPSG_3857_16 und für EPSG_25832_16 müsste ich das Koordinatensystem der Map generell ändern (was nach ein paar Versuchen auch nicht klappte). Schade, denn ein Tile Service ist viel performanter als ein WMS.
request.onerror = function() {
/*baseMaps['Digitale Orthophotos_'] = L.tileLayer('https://www.wmts.nrw.de/geobasis/wmts_nw_dop/tiles/nw_dop/EPSG_25832_16/{z}/{y}/{x}.png', {//EPSG_3857_16
callSafely(onFailure);
maxNativeZoom: 16,
};
//minNativeZoom: 15,
//minZoom: 13,
//maxZoom: 18,
//version: '1.0.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 crsEPSG25832 = new L.Proj.CRS/*L.CRS.proj4js*/('EPSG:25832', '+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs', new L.Transformation(0.5 / (Math.PI * L.Projection.Mercator.R_MAJOR), 0.5, -0.5 / (Math.PI * L.Projection.Mercator.R_MINOR), 0.5));
request.send();
}


baseMaps['Digitale Orthophotos'] = L.layerGroup([
function callSafely(callback) {
L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_dop?', {
if (callback) {
layers: 'nw_dop_rgb',
callback.apply(null, Array.prototype.slice.call(arguments, 1));
//crs: crsEPSG25832,//L.CRS.EPSG4326,
}
minZoom: 7,
}
maxZoom: 18,
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>'
}),
// Add an overlay to show streets etc.
L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_dop_overlay?', {
// TODO These layers don't work very well in a WMS because it's not meant to be displayed as tiles so labels are cut off at the tile borders or appear too many times (lots of tiles being displayed). Ideally we'd load this via WMTS.
layers: 'nw_dop_overlay_Stadt-Bahn-Haltestellen,nw_dop_overlay_Bahnhoefe,nw_dop_overlay_geonamen,nw_dop_overlay_autobahn,nw_dop_overlay_autobahn_beschriftung_1,nw_dop_overlay_autobahn_beschriftung_2,nw_dop_overlay_bundesstrassen,nw_dop_overlay_bundesstrassen_beschriftung_1,nw_dop_overlay_bundesstrassen_beschriftung_2,nw_dop_overlay_landstrassen,nw_dop_overlay_landstrassen_beschriftung,nw_dop_overlay_kreisstrassen,nw_dop_overlay_kreisstrassen_beschriftung,nw_dop_overlay_ortsstrassen,nw_dop_overlay_ortsstrassen_beschriftung,nw_dop_overlay_unbefahrbare_wege,nw_dop_overlay_strassen_bau,nw_dop_overlay_bab_anschlussstellen,nw_dop_overlay_gem_namen,nw_dop_overlay_krs_namen,nw_dop_overlay_faehren',
// nw_dop_overlay_hausnummern, // TODO Layer not available in coordinate systems supported natively by Leaflet.
//crs: crsEPSG25832,//L.CRS.EPSG4326,
minZoom: 7,
maxZoom: 18,
bounds: [
[52.57192795134163, 9.683550865862706],
[50.265130303028236, 5.532200974503678]
],
// Since this is an overlay it doesn't make much sense without transparency.
transparent: true,
// Transparency only works with PNGs.
format: 'image/png; mode=8bit',
version: '1.3.0'
}),
// Add layer for house numbers separately because we have to use a different coordinate system to display them and that system isn't implemented cleanly in the example I found so it would mess with the other overlay layers if I used it there too.
L.tileLayer.wms('https://www.wms.nrw.de/geobasis/wms_nw_dop_overlay?', {
layers: 'nw_dop_overlay_hausnummern',
crs: crsEPSG25832,//L.CRS.EPSG4326, // EPSG4326 is claimed to be supported by the capabilites document but it didn't work.
// TODO Do I want to adjust the zoom levels or the bounds for this? Will the bounds relate to the CRS?
minZoom: 7,
maxZoom: 18,
bounds: [
[52.57192795134163, 9.683550865862706],
[50.265130303028236, 5.532200974503678]
],
// Since this is an overlay it doesn't make much sense without transparency.
transparent: true,
// Transparency only works with PNGs.
format: 'image/png; mode=8bit',
version: '1.3.0'
})
]);


baseMaps['OpenStreetMap'] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
function getGeoJsonDataLayerUrl() {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
var dataLayer = getQueryParameter("dataLayer");
});
if (dataLayer) {
// TODO also check for https://www.mediawiki.org/wiki/Manual:Page_title
//    Base names equal to "." or "..", or beginning "./" or "../", or containing "/./" or "/../", or ending "/." or "/..".
// ?
if (dataLayer.indexOf("GeoJson:") === 0
&& dataLayer.indexOf("?") === -1
&& dataLayer.indexOf("&") === -1
&& dataLayer.indexOf("=") === -1
&& dataLayer.indexOf("/..") === -1) {
// TODO relative url?
return "https://altes-koeln.de/wiki/" + dataLayer + "?action=raw&ctype=application/json";
}
}
return undefined;
}


L.control.layers(baseMaps).addTo(map);
function getPoiDataLayerUrl() {
var poiConcept = getQueryParameter("pois");
if (poiConcept) {
// TODO Check the rest is a valid page name?
if (poiConcept.indexOf("Concept:") === 0) {
return "https://altes-koeln.de/api.php?action=askargs&conditions=" + poiConcept + "&printouts=Name|Position|Kurzbeschreibung|Siehe%20auch|Bild&format=json&api_version=3";
}
}
return undefined;
}
}


// Initialise all found maps when DOM is ready.
document.addEventListener("DOMContentLoaded", function(event) {
document.addEventListener("DOMContentLoaded", function(event) {
var mapElements = document.getElementsByClassName("ak-map");
var mapContainerElements = document.getElementsByClassName("ak-map-container");
for(var i = 0; i < mapElements.length; i++) {
 
initMap(mapElements.item(i));
var metadataElements = document.getElementsByClassName("ak-map-metadata");
var metadata = parseMetadata(metadataElements);
 
for (var i = 0; i < mapContainerElements.length; i++) {
initMap(mapContainerElements.item(i), metadata, getQueryParameter("baseLayer"), getQueryParameter("histLayer"), getGeoJsonDataLayerUrl(), getPoiDataLayerUrl());
}
}
});
});
Zeile 257: Zeile 888:
</script>
</script>


<div class="ak-map"></div>
<div class="ak-map-container">
<div class="ak-map"></div>
<form class="ak-map-sidebar" autocomplete="off">
<fieldset>
<legend>Basiskarte</legend>
<ul class="ak-map-basemaps">
<li><label><input type="radio" class="ak-base-map-selection--osm" name="ak-base-map-selection" value="osm" checked>OpenStreetMap</label></li>
<li><label><input type="radio" class="ak-base-map-selection--dop" name="ak-base-map-selection" value="dop">Digitale Orthophotos</label></li>
</ul>
</fieldset>
<fieldset>
<legend>Historische Karten</legend>
<ul class="ak-map-layers">
</ul>
</fieldset>
<fieldset>
<legend>Zeiträume Köln</legend>
<ul class="ak-map-links">
<li><a href="https://opjoeck.maps.arcgis.com/apps/webappviewer/index.html?id=af439c30276b45159de0503c0f09a1ab" target="_blank" rel="noopener noreferrer" title="Römische Befestigung, mittelalterliche Stadtmauer, Umwallungen, Bastionen, Festungsringe, Kasernen, Hochbunker">Verteidigen & Schützen</a></li>
<li><a href="https://opjoeck.maps.arcgis.com/apps/webappviewer/index.html?id=52cfb2e6bb7a422b8d6ca7dc8127f518" target="_blank" rel="noopener noreferrer" title="Klöster, Kirchen, Synagogen, Krankenhäuser, Friedhöfe">Beten & Heilen</a></li>
<li><a href="https://opjoeck.maps.arcgis.com/apps/webappviewer/index.html?id=02b93995ff994fd3b230fa398a6ff354" target="_blank" rel="noopener noreferrer" title="Höfe, Mühlen">Ackern & Mahlen</a></li>
<li><a href="https://opjoeck.maps.arcgis.com/apps/webappviewer/index.html?id=74dc24a4814e442792b1c62eb60fbc90" target="_blank" rel="noopener noreferrer" title="Fabriken, Gewerbe, Verwaltung, Bahnhöfe, Häfen, Flughäfen, Wasser Gas Strom, Brauereien, Ziegeleien">Arbeiten & Transportieren</a></li>
<li><a href="https://opjoeck.maps.arcgis.com/apps/webappviewer/index.html?id=3629a694ba67454eaf204c58054b48e6" target="_blank" rel="noopener noreferrer" title="Wohnen, Schulen, Freizeit, Theater, Kinos, Museen">Leben & Lernen</a></li>
<li><a href="https://hermsdoerfer.familyds.com/Cologne/Entwicklung.html" target="_blank" rel="noopener noreferrer">Siedlungs- und Gebietsentwicklung</a></li>
</ul>
</fieldset>
</form>
</div>

Aktuelle Version vom 7. Januar 2024, 14:08 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; padding: 2em; overflow-y: auto;

font-family: Arial, sans-serif; font-size: 16px; 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; font-size: 16px; }

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

.ak-map-container label { margin-bottom: 0; }

.ak-map-container input { margin-left: 0; margin-right: 0.5em; }

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

.ak-map-basemaps { display: flex; }

.ak-map-basemaps li+li { margin-left: 1em; }

.ak-map-layers li { display: flex; align-items: center; margin-bottom: 0; border-left-width: 0.5em; border-left-style: solid; padding-left: 0.5em; }

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

.ak-map-layers li label+a { display: inline-block; width: 16px; height: 16px; margin-left: 1em; /* Info icon taken from https://feathericons.com/ */ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2374c0fc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12' y2='8'%3E%3C/line%3E%3C/svg%3E"); }

.ak-map-layers li label+a:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23339af0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12' y2='8'%3E%3C/line%3E%3C/svg%3E"); }

.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; }

.ak-map-links { margin: 0; padding-left: 15px; list-style-image: none; }

.ak-map-links li + li { padding-top: 8px; }


/* Metadata container that may be added by the wiki page to hand more information over to the map. */ .ak-map-metadata { display: none; }


/* 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: 0.7, 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.setOpacityLayer(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, metadata, baseLayerToShow, historicalLayerToShow, geoJsonDataLayerUrl, poiDataLayerUrl) { if (mapContainerElement.dataset.initialised) { return; } mapContainerElement.dataset.initialised = true;

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

var mapView = L.map(mapElement, { // Bounding box for Köln (<https://www.openstreetmap.org/relation/62578>). maxBounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], }).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.de/tiles/osmde/{z}/{x}/{y}.png', { minZoom: 6, maxZoom: 18, 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', minZoom: 6, maxZoom: 18, 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: "Nachkriegszeit bis heute" } };

// Historical maps var maps = [ { id: "mercator", label: "1571 Mercator", tooltip: "Mercatorplan von Köln, auch bekannt als Kölner Stadtansicht von 1570/1571, Arnold Mercator", era: eras.mittelalter, layer: L.tileLayer('https://mapwarper.net/maps/tile/40952/{z}/{x}/{y}.png', { minZoom: 6, maxZoom: 18, // TODO Restrict bounds even further. bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], attribution: '<a href="https://mapwarper.net/maps/40952">Georeferenzierte Datei</a>, <a href="http://www.deutschefotothek.de/documents/obj/70305086">Originaldatei © SLUB / Deutsche Fotothek</a>, <a href="https://creativecommons.org/licenses/by-sa/4.0/">cc-by-sa</a>' }) }, { 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', { minZoom: 6, maxZoom: 17, // TODO Restrict bounds even further. bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], attribution: '<a href="https://mapwarper.net/maps/39783">Georeferenzierte Datei</a>' }) }, { id: "reinhardt", label: "1752 Reinhardt", tooltip: "Kölner Stadtplan von 1752, Johann Valentin Reinhardt", era: eras.mittelalter, layer: L.tileLayer('https://mapwarper.net/maps/tile/41691/{z}/{x}/{y}.png', { minZoom: 6, maxZoom: 18, // TODO Restrict bounds even further. bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], attribution: '<a href="https://mapwarper.net/maps/41691">Georeferenzierte Datei</a>' }) }, { 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', { minZoom: 6, maxZoom: 17, // TODO Restrict bounds even further. bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], attribution: '<a href="https://mapwarper.net/maps/39780">Georeferenzierte Datei</a>' }) }, { 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, bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], 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', { minZoom: 6, maxZoom: 18, // TODO Restrict bounds even further. bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], attribution: '<a href="https://mapwarper.net/maps/39826">Georeferenzierte Datei</a>' }) }, { id: "festungsplan", label: "1815-1918 Festungsplan", tooltip: "Standorte von militärischen Bauwerken und Anlagen in den Jahren 1815-1918", era: eras.preussisch, layer: L.tileLayer('https://mapwarper.net/maps/tile/56436/{z}/{x}/{y}.png', { minZoom: 6, maxZoom: 18, // TODO Restrict bounds even further. bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], attribution: '<a href="https://mapwarper.net/maps/56436">Georeferenzierte Datei</a>' }) }, { 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_rw', minNativeZoom: 14, minZoom: 12, maxZoom: 17, bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], 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, bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], // 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', 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', { minZoom: 6, maxZoom: 17, // TODO Restrict bounds even further. bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], attribution: '<a href="https://mapwarper.net/maps/39790">Georeferenzierte Datei</a>' }) }, { id: "tk25", label: "1936-1945 TK25", tooltip: "Topographische Karten - ältere Auflagejahre", era: eras.preussisch, 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, bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], 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, bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], 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, bounds: [ [50.8304494, 6.7725303], [51.0849743, 7.1620280] ], 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 ",".

var baseLayerOsmElement = mapContainerElement.querySelector(".ak-base-map-selection--osm"); var baseLayerDopElement = mapContainerElement.querySelector(".ak-base-map-selection--dop");

// Keeping track of selected layers. Set initially selected ones. var currentHistLayer = maps[0]; var currentBaseLayer = osmLayer; if (baseLayerToShow) { if (baseLayerToShow === "osm") { currentBaseLayer = osmLayer; } else if (baseLayerToShow === "dop") { currentBaseLayer = dopLayer; baseLayerDopElement.checked = true; } } if (historicalLayerToShow) { for (var i = 0; i < maps.length; i++) { if (maps[i].id === historicalLayerToShow) { currentHistLayer = maps[i]; break; } } }

// Switching between base layers function baseLayerSwitcher() { if (this.checked) { currentBaseLayer.remove(); if (this.value === "osm") { currentBaseLayer = osmLayer; } else { currentBaseLayer = dopLayer; } // TODO Funktioniert nicht. currentBaseLayer.options.minZoom = currentHistLayer.layer.minZoom; currentBaseLayer.options.maxZoom = currentHistLayer.layer.maxZoom; currentBaseLayer.addTo(mapView); currentBaseLayer.bringToBack(); } } baseLayerOsmElement.addEventListener("change", baseLayerSwitcher); baseLayerDopElement.addEventListener("change", baseLayerSwitcher);

// Setting opacity var opacitySliderControl = L.control.opacitySlider({ opacityLayer: currentHistLayer.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 === currentHistLayer) { inputElement.checked = true; }

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

var mapPageUrl = metadata[map.id]; if (mapPageUrl) { var pageLinkElement = L.DomUtil.create("a"); pageLinkElement.href = mapPageUrl; pageLinkElement.setAttribute("title", "Zur Kartenseite"); pageLinkElement.setAttribute("aria-label", "Zur Kartenseite"); listItemElement.appendChild(pageLinkElement); } });

// Show layers. currentBaseLayer.addTo(mapView); currentHistLayer.layer.addTo(mapView);

// Load data layer if provided. if (geoJsonDataLayerUrl) { loadJson(geoJsonDataLayerUrl, function(data) { var options = { // TODO add tooltips/markers/styles etc. from data using onEachFeature/style function options, implementing <https://github.com/mapbox/simplestyle-spec/tree/master/1.1.0>. // see <https://leafletjs.com/reference-1.5.0.html#geojson>. style: function(geoJsonFeature) { return { interactive: false }; } }; if (data.attributionText && data.attributionUrl) { // Create as DOM node and then convert back to text to escape attribution content and prevent XSS attacks. var attributionLinkElement = L.DomUtil.create("a"); attributionLinkElement.href = data.attributionUrl; attributionLinkElement.appendChild(document.createTextNode(data.attributionText)); options.attribution = attributionLinkElement.outerHTML; } var dataLayer = L.geoJSON(data, options); dataLayer.addTo(mapView); // Set view and zoom around shapes being shown. // TODO Might want to introduce some padding later. But consider <https://stackoverflow.com/a/55173276>. // TODO This does a really visible zoom out / movement which might be nauseating. Maybe we can load the data earlier (in parallel to waiting for DOMContentLoaded) and only render the map once it is available (with a timeout). mapView.fitBounds(dataLayer.getBounds()); }, function() { mapView.openPopup("Die Daten für das anzuzeigende Objekt konnten leider nicht geladen werden. 🙁", mapView.getCenter()); }); }

if (poiDataLayerUrl) { loadJson(poiDataLayerUrl, function(response) { var data = convertSmwResultToGeoJson(response); var options = { pointToLayer: function(geoJsonPoint, latlng) { var options = { riseOnHover: true }; if (geoJsonPoint.properties && geoJsonPoint.properties.title) { options.title = geoJsonPoint.properties.title; } return L.marker(latlng, options); }, onEachFeature: function(feature, layer) { if (feature.properties && (feature.properties.description || feature.properties.url || feature.properties.pictureUrl)) { var popupContent = ""; if (feature.properties.title) { if (feature.properties.url) {

popupContent += "

<a href=\"" + feature.properties.url + "\">" + feature.properties.title + "</a>

";

} else {

popupContent += "

" + feature.properties.title + "

";

} } if (feature.properties.description) {

popupContent += "

" + feature.properties.description + "

";

} if (feature.properties.pictureUrl) {

popupContent += "

<img src=\"" + feature.properties.pictureUrl + "\" />

";

} if (feature.properties.url && !feature.properties.title) {

popupContent += "

<a href=\"" + feature.properties.url + "\">Seite besuchen</a>

";

} layer.bindPopup(popupContent); } } }; var dataLayer = L.geoJSON(data, options); dataLayer.addTo(mapView); }, function() { mapView.openPopup("Die anzuzeigenden Daten konnten leider nicht geladen werden. 🙁", mapView.getCenter()); }); } }

function convertSmwResultToGeoJson(response) { var results = response.query.results; var geoJson = { "type": "FeatureCollection", "features": [] }; geoJson.features = results.map(function(result) { // For some reason the actual semantic object is in a property in the result object, with the key being the id of the object. // Since we don't know the id in advance we have to fetch it as the first (and hopefully only) key of the object. var object = result[Object.keys(result)[0]]; // Can't handle results without coordinates, so skip this one. if (typeof object.printouts.Position === "undefined" || object.printouts.Position.length === 0) { return null; } var feature = { "type": "Feature", "geometry": { "type": "Point", "coordinates": [object.printouts.Position[0].lon, object.printouts.Position[0].lat] }, "properties": {} }; if (typeof object.printouts.Name !== "undefined" && object.printouts.Name.length) { feature.properties.title = object.printouts.Name[0]; } if (typeof object.printouts.Kurzbeschreibung !== "undefined" && object.printouts.Kurzbeschreibung.length) { feature.properties.description = object.printouts.Kurzbeschreibung[0]; } if (typeof object.printouts["Siehe auch"] !== "undefined" && object.printouts["Siehe auch"].length) { feature.properties.url = object.printouts["Siehe auch"][0]; } if (typeof object.printouts.Bild !== "undefined" && object.printouts.Bild.length) { feature.properties.pictureUrl = object.printouts.Bild[0]; } return feature; }).filter(function(e) { // Since we might have skipped some invalid results by returning null, we need to filter them out. return e != null; }); return geoJson; }

function parseMetadata(metadataElements) { var metadata = {}; for (var i = 0; i < metadataElements.length; i++) { var element = metadataElements.item(i); var queryRowElements = element.querySelectorAll(".smw-format.ul-format .smw-row"); forEachElement(queryRowElements, function(row) { var anchorElement = row.querySelector(".smw-field:first-child .smw-value a"); var url = anchorElement.href; var idValueElement = row.querySelector(".smw-field:last-child .smw-value"); var id = idValueElement.textContent; metadata[id] = url; }); } return metadata; }

function forEachElement(nodeList, callback) { if (nodeList.forEach) { nodeList.forEach(callback); } else { Array.prototype.forEach.call(nodeList, callback); } }

var getQueryParameter = (function() { var query = window.location.search.substring(1); var params = query.split("&"); params = params.map(function(param) { var pair = param.split("="); pair[0] = decodeURIComponent(pair[0]); if (pair.length > 1) { pair[1] = decodeURIComponent(pair[1]); } return pair; }); return function(parameterName) { for (var i = 0; i < params.length; i++) { if (params[i][0] === parameterName) { if (params[i].length > 1) { return params[i][1]; } return ""; } } return undefined; }; })();

function loadJson(url, onSuccess, onFailure) { var request = new XMLHttpRequest(); request.open("GET", url, true);

request.onload = function() { if (request.status >= 200 && request.status < 400) { var data; try { data = JSON.parse(request.responseText); } catch(error) { callSafely(onFailure, error); return; } callSafely(onSuccess, data); } else { callSafely(onFailure); } };

request.onerror = function() { callSafely(onFailure); };

request.send(); }

function callSafely(callback) { if (callback) { callback.apply(null, Array.prototype.slice.call(arguments, 1)); } }

function getGeoJsonDataLayerUrl() { var dataLayer = getQueryParameter("dataLayer"); if (dataLayer) { // TODO also check for https://www.mediawiki.org/wiki/Manual:Page_title // Base names equal to "." or "..", or beginning "./" or "../", or containing "/./" or "/../", or ending "/." or "/..". // ? if (dataLayer.indexOf("GeoJson:") === 0 && dataLayer.indexOf("?") === -1 && dataLayer.indexOf("&") === -1 && dataLayer.indexOf("=") === -1 && dataLayer.indexOf("/..") === -1) { // TODO relative url? return "https://altes-koeln.de/wiki/" + dataLayer + "?action=raw&ctype=application/json"; } } return undefined; }

function getPoiDataLayerUrl() { var poiConcept = getQueryParameter("pois"); if (poiConcept) { // TODO Check the rest is a valid page name? if (poiConcept.indexOf("Concept:") === 0) { return "https://altes-koeln.de/api.php?action=askargs&conditions=" + poiConcept + "&printouts=Name|Position|Kurzbeschreibung|Siehe%20auch|Bild&format=json&api_version=3"; } } return undefined; }

// Initialise all found maps when DOM is ready. document.addEventListener("DOMContentLoaded", function(event) { var mapContainerElements = document.getElementsByClassName("ak-map-container");

var metadataElements = document.getElementsByClassName("ak-map-metadata"); var metadata = parseMetadata(metadataElements);

for (var i = 0; i < mapContainerElements.length; i++) { initMap(mapContainerElements.item(i), metadata, getQueryParameter("baseLayer"), getQueryParameter("histLayer"), getGeoJsonDataLayerUrl(), getPoiDataLayerUrl()); } }); })(); </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> <fieldset> <legend>Zeiträume Köln</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.