-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathab-street-compare.html
118 lines (92 loc) · 4.38 KB
/
ab-street-compare.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
title: AB Street Compare Page – ATM this does not work
layout: null
---
<!Doctype html>
<html lang="de">
<head>
<meta charset=utf-8 />
<title>{{ page.title }}</title>
<link rel="shortcut icon" href="{{ '/images/favicon.png' | relative_url }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<!-- Stylesheet for Leafvar icons, fonts etc -->
<link rel="stylesheet" href="{{ '/css/leaflet.css' | relative_url }}" />
<!--jquery - enables loading a GeoJson from a file directly into Leafvar -->
<script src="{{ '/javascript/leaflet.js' | relative_url }}"></script>
<script src="{{ '/javascript/leaflet-hash.js' | relative_url }}"></script>
</head>
<body>
<div id="app" style="position: absolute; top:0; bottom:0; left:0; right:50%; background-color: lightyellow; "></div>
<script type="module">
import { OSMViewer } from "https://abstreet.s3-website.us-east-2.amazonaws.com/0.2.62/osm_viewer/osm_viewer.bundle.js";
let app = new OSMViewer("app");
document.addEventListener("DOMContentLoaded", function (event) {
app.loadAndStart();
});
</script>
<div class="leaflet-container"
style="position: absolute; bottom: 10px; left: 10px; z-index: 1000; background-color: white; padding: 5px;">
<a href="https://github.com/a-b-street/abstreet/issues/777#issuecomment-941784699">AB Street Github Issue</a>
</div>
<div id="map" style="position: absolute; top:0; bottom:0; left:50%; right:0; background-color: silver; "></div>
<script>
const optionsFromHash = L.Hash.parseHash(window.location.hash)
var options = {
center: optionsFromHash.center || [52.48150, 13.43571],
zoom: optionsFromHash.zoom || 18,
minZoom: 15,
zoomControl: true,
maxBounds: [[52.4557, 13.3985], [52.5005, 13.4863]]
}
const map = L.map("map", options);
const hash = new L.Hash(map);
const parkingmap = L.tileLayer("https://supaplex.uber.space/micromap/tiles/parkingmap/{z}/{x}/{y}.jpg", {
name: 'parkingmap',
maxZoom: 21,
maxNativeZoom: 20,
layerControlName: "Parkraumkarte<br><span style='margin-left: 16px;' class='text-gray-400'>Datenstand: {{ page.parkingmap_tiles_updated_at }}</span>",
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap-Mitwirkende</a>, Bordsteinkanten: OpenStreetMap und Geoportal Berlin / ALKIS.'
})
parkingmap.addTo(map); // This is the initial basemap
const micromap = L.tileLayer("https://supaplex.uber.space/micromap/tiles/{z}/{x}/{y}.jpg", {
name: 'micromap',
maxZoom: 21,
maxNativeZoom: 20,
layerControlName: "Straßenraumkarte<br><span style='margin-left: 16px;' class='text-gray-400'>Datenstand: {{ page.micromap_tiles_updated_at }}</span>",
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap-Mitwirkende</a>, Bordsteinkanten: OpenStreetMap und Geoportal Berlin / ALKIS.'
});
const debugmap = L.tileLayer("https://supaplex.uber.space/micromap/tiles/debug/{z}/{x}/{y}.jpg", {
name: 'debugmap',
maxZoom: 21,
maxNativeZoom: 20,
layerControlName: "Debug-Modus Straßenraumkarte<br><span style='margin-left: 16px;' class='text-gray-400'>Datenstand: {{ page.debugmap_tiles_updated_at }}</span>",
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap-Mitwirkende</a>, Bordsteinkanten: OpenStreetMap und Geoportal Berlin / ALKIS.'
});
const osm = L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
name: 'osm',
maxZoom: 21,
maxNativeZoom: 19,
layerControlName: "OpenStreetMap",
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
// name set of tilelayers and adds them to the layer-selector
const baseMaps = {
[parkingmap.options.layerControlName]: parkingmap,
[micromap.options.layerControlName]: micromap,
[debugmap.options.layerControlName]: debugmap,
[osm.options.layerControlName]: osm,
};
// ?map-Param: Helper: mapLayer from ?map-Param
// (this will only work for just one param)
const mapLayerNameFromURLParam = function () {
return window.location.search.substr(1).split('=')[1]
}
L.control.layers(baseMaps, null, { collapsed: false }).addTo(map);
</script>
<div class="leaflet-container"
style="position: absolute; bottom: 10px; left: calc( 50% + 10px ); z-index: 1000; background-color: white; padding: 5px;">
<a href="{{ '/imprint' | relative_url }}">Impressum</a>
</div>
</body>
</html>