-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
242 lines (209 loc) · 9.22 KB
/
index.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<html>
<head>
<title>Street Lamps in OSM</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="description" content="This map shows street lamps and their settings in the data of OpenStreetMap. It shows e.g. operators, reference numbers and details about the used lights.">
<link rel="stylesheet" href="leaflet/leaflet.css" />
<link rel="stylesheet" href="leaflet/plugins/Control.Opacity/Control.Opacity.css" />
<link rel="stylesheet" href="leaflet/plugins/leaflet-locatecontrol/L.Control.Locate.min.css" />
<link rel="stylesheet" href="leaflet/plugins/leaflet-control-geocoder/Control.Geocoder.css" />
<link rel="stylesheet" href="jquery/jquery-ui.min.css" />
<link rel="stylesheet" href="style.css" />
<!-- Load settings -->
<script src="js/settings.js" type="text/javascript"></script>
<!-- Load jquery -->
<script src="jquery/jquery-1.12.4.min.js"></script>
<script src="jquery/jquery-ui.min.js"></script>
<!-- Load i18next -->
<script src="i18next/i18next.min.js"></script>
<script src="i18next/i18nextHttpBackend.min.js"></script>
<script src="i18next/i18nextBrowserLanguageDetector.min.js"></script>
<script src="js/i18nextInit.js"></script>
<!-- Load leaflet -->
<script src="leaflet/leaflet.js"></script>
<script src="leaflet/plugins/leaflet-geolocation/leaflet-geolocation.js"></script>
<script src="leaflet/plugins/leaflet-locatecontrol/L.Control.Locate.min.js"></script>
<script src="leaflet/plugins/leaflet-hash/leaflet-hash.js"></script>
<script src="leaflet/plugins/Control.Opacity/Control.Opacity.js"></script>
<script src="leaflet/plugins/LanguageSelector/LanguageSelector.js"></script>
<script src="leaflet/plugins/leaflet-control-geocoder/Control.Geocoder.js"></script>
<script src="leaflet/plugins/heatmap.js/build/heatmap.js"></script>
<script src="leaflet/plugins/heatmap.js/plugins/leaflet-heatmap/leaflet-heatmap.js"></script>
<script src="js/parse_scripts.js" type="text/javascript"></script>
</head>
<body style="margin:0px">
<div id="map" style="height: 100%"></div>
<script>
MarkerArray = new Array();
let g_showStreetLightsLowZoomOnce = false
var HeatMap_cfg = {
"maxZoom" : 19,
"minZoom" : MIN_ZOOM_LOW_ZOOM,
// radius should be small ONLY if scaleRadius is true (or small radius is intended)
"radius": 1 ,
"maxOpacity": .5,
"minOpacity": .01,
// scales the radius based on map zoom
"scaleRadius": false,
"blur": 0.99,
// if set to false the heatmap uses the global maximum for colorization
// if activated: uses the data maximum within the current map boundaries
// (there will always be a red spot with useLocalExtremas true)
"useLocalExtrema": true,
// which field name in your data represents the latitude - default "lat"
latField: 'lat',
// which field name in your data represents the longitude - default "lng"
lngField: 'lng',
// which field name in your data represents the data value - default "value"
valueField: 'count',
gradient: {
// enter n keys between 0 and 1 here
// for gradient color customization
// '.1': 'black',
'.9': 'white'
}
};
var StreetLightsLowZoomLayer = new HeatmapOverlay(HeatMap_cfg);
var StreetLightsLayer = new L.LayerGroup([],{
maxZoom : 19,
minZoom : MIN_ZOOM
});
var AviationLayer = new L.LayerGroup([],{
maxZoom : 19,
minZoom : MIN_ZOOM
});
var LitStreetsLayer = new L.LayerGroup([],{
maxZoom : 19,
minZoom : MIN_ZOOM
});
var UnLitStreetsLayer = new L.LayerGroup([],{
maxZoom : 19,
minZoom : MIN_ZOOM
});
var OverpassAttrib = 'Data via <a href="http://www.overpass-api.de/">Overpass API</a>';
var OSM_carto = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | ' + OverpassAttrib
});
var OSM_de = L.tileLayer('https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors | ' + OverpassAttrib
});
var OSM_fr = L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {
maxZoom: 20,
attribution: '© OpenStreetMap France | © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors | ' + OverpassAttrib
});
var OpenTopoMap = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
maxZoom: 17,
attribution: 'Map data: © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>) | ' + OverpassAttrib
});
var map = new L.Map('map');
var baseMaps = {
"OpenStreetMap Carto": OSM_carto,
"OpenStreetMap DE": OSM_de,
"OpenStreetMap FR": OSM_fr,
"OpenTopoMap": OpenTopoMap
};
var overlayMaps = {
"<span id='layer_street_lights_lowzoom'>Street Lights Low Zoom</span>": StreetLightsLowZoomLayer,
"<span id='layer_street_lights'>Street Lights</span>": StreetLightsLayer,
"<span id='layer_aviation_lights'>Aviation Lights</span>": AviationLayer,
"<span id='layer_lit_streets'>Lit Streets</span>": LitStreetsLayer,
"<span id='layer_unlit_streets'>Unlit Streets</span>": UnLitStreetsLayer
};
// add locate control:
if (SHOW_GEOLOCATE_BUTTON) {
var lc = L.control.locate({
setView : "once",
initialZoomLevel : 13,
showCompass : false,
drawCircle : false,
drawMarker : false,
clickBehavior: {
inView : "setView",
outOfView : "setView",
inViewNotFollowing : "setView"
}
}).addTo(map);
}
// add LanguageSelector
var LanguageSelector = new L.Control.LanguageSelector();
map.addControl(LanguageSelector);
// add maps
L.control.layers(baseMaps, overlayMaps).addTo(map);
// add opacity control
var current_layer = OSM_carto
var opacitySlider = new L.Control.opacitySlider();
map.addControl(opacitySlider);
opacitySlider.setOpacityLayer(current_layer);
// add geocoder
var geocoder = L.Control.geocoder({
defaultMarkGeocode: false
}).on('markgeocode', function(e) {
var bbox = e.geocode.bbox;
map.fitBounds(bbox,{maxZoom : 14});
})
geocoder.addTo(map);
loadingcounter = 0;
var showStreetLights = false;
var showStreetLightsLowZoom = false;
var opacityHigh = 0.2; // opacity level when showing street lights
var opacityLow = 1.0; // opacity level when not showing street lights
// default starting view of whole world
var ort = new L.LatLng(30, 10);
map.setView(ort, 3).addLayer(current_layer);
// Request rough IP-based location if none is found in URL
if (document.URL.search(/#/)==-1){
L.GeoLocation.centerMapOnPosition(map, 8)
}
// Default layers
map.addLayer(StreetLightsLayer);
map.addLayer(AviationLayer);
// Activate layer from the start when URL contains streets_lit or streets_unlit
if(window.location.search.indexOf("streets_lit") != -1) {
map.addLayer(LitStreetsLayer);
}
if(window.location.search.indexOf("streets_unlit") != -1) {
map.addLayer(UnLitStreetsLayer);
}
//Trigger reload when layers are added or removed
StreetLightsLowZoomLayer.on('add',function(){MoveCall(2);});
StreetLightsLowZoomLayer.on('remove',function(){MoveCall(3);});
StreetLightsLayer.on('add',function(){MoveCall(1);});
StreetLightsLayer.on('remove',function(){MoveCall(4);});
AviationLayer.on('add',function(){MoveCall(1);});
AviationLayer.on('remove',function(){MoveCall(3);});
LitStreetsLayer.on('add',function(){MoveCall(1);});
LitStreetsLayer.on('remove',function(){MoveCall(3);});
UnLitStreetsLayer.on('add',function(){MoveCall(1);});
UnLitStreetsLayer.on('remove',function(){MoveCall(3);});
//Permalink
var hash = new L.Hash(map);
map.on('moveend',function(){MoveCall(0);});
function openinJOSM(type, ID){
$.ajax({
url: "http://127.0.0.1:8111/load_and_zoom?left="+lefttop.lng+"&right="+rightbottom.lng+"&top="+lefttop.lat+"&bottom="+rightbottom.lat+"&select="+type+ID
});
}
map.on('baselayerchange', function (e) {
current_layer = e.layer;
opacitySlider.setOpacityLayer(current_layer);
});
</script>
<div id="zoomwarning_cont" style="display:none">
<div id="zoomwarning">
<p id="zoomtext">Zoom in to load data</p>
<p><a onclick="loadLowZoomDataOnce()" id="update_lowzoom_data">Update low zoom overview (1x)</a><a onclick="loadLowZoomDataOnce()" id="load_lowzoom_data">Load low zoom overview (1x)</a> <a onclick="clearLowZoomData()" id="clear_lowzoom_data">(Clear)</a></p>
</div>
</div>
<div id="loading_cont" style="display:none">
<div id="loading"><span id="loading_icon" class="loading_spinner"></span><span id="loading_text"></span></div>
</div>
<div id="options_cont">
<div id="options">
<small><a target="_new" href="./about.html" id="aboutmap">About this map</a></small>
</div>
</div>
</body>
</html>