forked from cyclosm/cyclosm-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
463 lines (422 loc) · 22.4 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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0">
<meta name=description content="CyclOSM is a beautiful open cycle map built on top of OpenStreetMap data. It provides a useful map for each and every cyclist, no matter the practice (commuting, touring, …). CyclOSM is a free and open-source software.">
<meta name="twitter:image:src" content="https://www.cyclosm.org/images/social_media.png" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="CyclOSM">
<meta name="twitter:description" content="A bicycle-oriented map for every cyclist, based on OpenStreetMap data.">
<meta property="og:site_name" content="CyclOSM" />
<meta property=og:image content="https://www.cyclosm.org/images/social_media.png">
<meta property=og:type content="website">
<meta property=og:title content="CyclOSM">
<meta property=og:url content="https://cyclosm.org/">
<meta property=og:description content="A bicycle-oriented map for every cyclist, based on OpenStreetMap data.">
<link rel="icon" type="image/png" sizes="16x16" href="https://www.cyclosm.org/images/favicon-16.png">
<link rel="icon" type="image/png" sizes="228x228" href="https://www.cyclosm.org/images/favicon-228.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://www.cyclosm.org/images/favicon-32.png">
<link rel="shortcut icon" href="https://www.cyclosm.org/images/favicon.ico">
<link rel="manifest" href="./manifest.webmanifest">
<title>CyclOSM: OpenStreetMap-based bicycle map</title>
<link rel="stylesheet" href="css/leaflet.css">
<link rel="stylesheet" href="css/Control.Geocoder.css">
<link rel="stylesheet" href="css/easy-button.css">
<link rel="stylesheet" href="css/L.Control.Locate.min.css">
<link rel="stylesheet" href="css/fa-all.min.css">
<link rel="stylesheet" href="css/tingle.min.css">
<style type="text/css">
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: url('/webfonts/roboto-v20-latin-regular.eot'); /* IE9 Compat Modes */
src: local('Roboto'), local('Roboto-Regular'),
url('/webfonts/roboto-v20-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/webfonts/roboto-v20-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/webfonts/roboto-v20-latin-regular.woff') format('woff'), /* Modern Browsers */
url('/webfonts/roboto-v20-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/webfonts/roboto-v20-latin-regular.svg#Roboto') format('svg'); /* Legacy iOS */
}
html {
min-height: 100%;
position: relative;
font-family: Roboto, sans-serif;
}
body {
margin: 0;
width: 100%;
height: 100%;
text-align: justify;
font-size: 14px;
overflow: hidden;
}
p {
text-indent: 2em;
}
div#modal-content {
display: none;
}
div#map {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
right: 42px;
}
.tingle-modal {
z-index: 2000;
color: #2e4369;
}
.tingle-modal a, .tingle-modal a:visited {
color: #2e4369;
}
.tingle-modal-box__content {
padding: 3rem;
}
.center {
text-align: center;
}
.footnote {
font-size: 0.9em;
}
#mainTitle {
margin-top: 0;
}
#legend {
width: 42px;
max-width: 100vw;
display: flex;
flex-direction: row;
position: absolute;
right: 0;
top: 0;
bottom: 0;
}
#legend button {
height: 100%;
width: 42px;
background-color: #2e4369;
color: #fff;
border: 0;
cursor: pointer;
}
#legend .iframe {
display: none;
}
#legend iframe {
width: 100%;
padding-left: 0.5em;
height: 100%;
border: 0;
box-sizing: border-box;
}
@media screen and (max-width: 540px) {
.tingle-modal__close {
background-color: #2e4369;
}
}
.error {
font-size: 2em;
text-align: center;
color: red;
}
.leaflet-control .fa {
font-size: 14px;
}
</style>
</head>
<body>
<div id="modal-content">
<h1 class="center" id="mainTitle">CyclOSM: OpenStreetMap-based bicycle map</h1>
<p>
<a href="https://github.com/cyclosm/cyclosm-cartocss-style/">CyclOSM</a> is a bicycle-oriented map built on top of <a href="https://www.openstreetmap.org/">OpenStreetMap</a> data <a href="#footnote-1">[1]</a>. It aims at providing a beautiful and practical map for cyclists, no matter their cycling habits or abilities.
</p>
<p>
In urban areas, it renders the main different types of cycle tracks and lanes, on each side of the road, for helping you draw your bike to work route. It also features essential POIs as well as bicycle parking spots or spots shared with motorbikes, specific infrastructure (elevators / ramps), road speeds or surfaces to avoid streets with pavings, bumpers and bike boxes, etc.
</p>
<p>
The same map also lets you visualize main bicycle touring routes as well as essential POIs when touring (emergency services, shelters, tourism, shops).
</p>
<p style="margin-bottom: 0;">
We offer three different map styles:
</p>
<ul style="margin-top: 0; margin-left: 1em;">
<li>The <strong>default CyclOSM</strong> style, fit for most applications <a href="#footnote-3">[3]</a> and map purposes (tiles can be cached for up to a few hours <a href="#footnote-4">[4]</a>);</li>
<li>The <strong>CyclOSM live</strong> style, fit for OpenStreetMap contributors (tiles are always minute updated) and available only at <a href="https://cyclosm.org/">cyclosm.org</a> and in contributions tools;</li>
<li>The <strong>CyclOSM lite</strong> variant, meant to be used as an overlay map to turn any map style into a bike map.</li>
</ul>
<p class="center">
<a class="modalClose" href="#"><img title="CyclOSM" alt="CyclOSM logo" style="height: 150px;" src="images/logo.png"/></a>
</p>
<h2 class="center"><a class="modalClose" href="#">Let's start exploring the map!</a></h2>
<p class="footnote" id="footnote-1">
[1] CyclOSM map is based on <a href="https://www.openstreetmap.org/">OpenStreetMap</a> data. CyclOSM is not a complete or accurate map of the world and should not be used in such a manner that deficiencies, omissions, inaccuracies or errors could result in death, loss or injury. The maps are an iterative ongoing work-in-progress and everyone is welcome to contribute editing the OpenStreetMap data if you spot inaccuracies.
</p>
<p class="footnote" id="footnote-2">
[2] CyclOSM is built on open-source and free software. The source code is available at <a href="https://github.com/cyclosm/cyclosm-cartocss-style/">Github</a> and we welcome <a href="https://github.com/cyclosm/cyclosm-cartocss-style/blob/master/CONTRIBUTING.md">contributions</a>!. Our tile server infrastructure is provided by <a href="https://www.openstreetmap.fr">OpenStreetMap-France</a>, many thanks to them for their support!
</p>
<p class="footnote" style="margin-bottom: 0;" id="footnote-3">
[3] The map is available by default in the following smartphone applications:
</p>
<ul class="footnote" style="margin-top: 0; margin-left: 1em; margin-bottom: 0;">
<li><a href="https://osmand.net">OSMAnd</a></li>
<li><a href="https://www.offline-maps.net">All-In-One Offline Maps</a> or <a href="https://alpinequest.net">AlpineQuest Rando GPS</a></li>
<li><a href="https://framagit.org/tom79/openmaps">OpenMultiMaps</a></li>
<li>Let us know about any more application we are missing!</li>
</ul>
<p class="footnote" style="margin-top: 0;">
A Tile Map Service is available at <code>https://{s}.tile-cyclosm.openstreetmap.fr/[cyclosm|cyclosm-lite]/{z}/{x}/{y}.png</code> under a <a href="https://operations.osmfoundation.org/policies/tiles/">fairuse tile policy</a>.
</p>
<p class="footnote" id="footnote-4">
[4] OpenStreetMap data should be replicated in near realtime CyclOSM style, the current delay between OpenStreetMap data and our maintained version can be seen <a href="https://munin.openstreetmap.fr/osm11.openstreetmap.fr/osm165.openstreetmap.fr/osm_replication_lag_osm2pgsql.html">here</a>. Tiles below zoom level 12 are pre-generated on a weekly basis, tiles at higher zooms are live-generated and then cached for up to 72 hours (except for the <em>live</em> variant).
</p>
</div>
<div id="map"></div>
<div id="legend">
<button>❮</button>
<div class="iframe"><iframe src="https://cyclosm.org/legend.html"></iframe></div>
</div>
<script src="js/leaflet.js"></script>
<script src="js/leaflet-fullHash.js"></script>
<script src="js/Control.Geocoder.js"></script>
<script src="js/easy-button.js"></script>
<script src="js/L.Control.Locate.js"></script>
<script src="js/leaflet.restoreview.js"></script>
<script src="js/tingle.min.js"></script>
<script type="text/javascript">
var VERSION = 'v0.4'; // TODO: Bump when pushing new version in production
var FORCE_MODAL = false;
// Register service worker for PWA
if('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js');
};
function storageAvailable(type) {
try {
var storage = window[type],
x = '__storage_test__';
storage.setItem(x, x);
storage.removeItem(x);
return true;
}
catch(e) {
console.warn("Your browser blocks access to " + type);
return false;
}
}
function shouldShowModalOnStartup () {
if (FORCE_MODAL) {
return true;
}
if (!storageAvailable('localStorage')) {
return true;
}
if (window.localStorage['lastModalShown'] !== VERSION) {
return true;
}
return false;
}
document.addEventListener('DOMContentLoaded', function () {
// ============
// Handle modal
// ============
var modal = new tingle.modal({
footer: false,
closeMethods: ['overlay', 'button', 'escape'],
closeLabel: "Go to map",
});
modal.setContent(document.querySelector('#modal-content').innerHTML);
[].forEach.call(modal.modalBoxContent.querySelectorAll('a.modalClose'), function (item) {
item.addEventListener('click', function (event) {
event.preventDefault();
modal.close();
});
});
if (shouldShowModalOnStartup()) {
modal.open();
if (storageAvailable('localStorage')) {
window.localStorage['lastModalShown'] = VERSION;
}
}
// ==========
// Handle map
// ==========
// Available tiles definition
var cyclosm = L.tileLayer('https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors',
minZoom: 0,
maxZoom: 20,
});
var cyclosm_live = L.tileLayer('https://dev.{s}.tile.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors',
minZoom: 0,
maxZoom: 20,
});
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors',
minZoom: 0,
maxZoom: 19,
});
var piano = L.tileLayer('https://{s}.piano.tiles.quaidorsay.fr/fr/{z}/{x}/{y}.png', {
attribution: 'Tiles <a href="https://github.com/tilery/pianoforte">PianoFr</a> | © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors',
minZoom: 0,
maxZoom: 20,
});
var ocm = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors',
minZoom: 0,
maxZoom: 18,
});
var otm = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors',
minZoom: 0,
maxZoom: 18,
});
var cyclosm_lite = L.tileLayer('https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm-lite/{z}/{x}/{y}.png', {
attribution: 'CyclOSM Lite',
minZoom: 11,
maxZoom: 20,
});
var cyclosm_be = L.tileLayer('https://{s}.tiles.champs-libres.be/cyclosm/{z}/{x}/{y}.png', {
attribution: 'MNT 2013-2014 © SPW; DHM Vlaanderen II © Vlaanderen. Tiles courtesy of <a href="https://www.champs-libres.coop/blog/post/2020-09-17-cyclosm/">Champs-Libres</a>.',
minZoom: 11,
maxZoom: 20,
});
var waymarked_trails = L.tileLayer('https://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png', {
attribution: '<a href="https://cycling.waymarkedtrails.org/">https://cycling.waymarkedtrails.org/</a>',
minZoom: 0,
maxZoom: 18,
});
var map = new L.Map('map', {
zoomControl: true, layers: [cyclosm]
});
map.attributionControl.setPrefix('<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet</a> | <a href="https://github.com/cyclosm/cyclosm-cartocss-style/releases" title="CyclOSM - Open Bicycle render">CyclOSM</a> ' + VERSION);
if (!map.restoreView()) {
// Default view on Amsterdam
map.setView([52.3727598, 4.8936041], 12);
}
// Set up layers control
var baseMaps = {
"CyclOSM": cyclosm,
"CyclOSM (Live)": cyclosm_live,
"CyclOSM (better for BE)": cyclosm_be,
"OpenStreetMap.org": osm,
"OpenCycleMap": ocm,
"OpenTopoMap": otm,
"OSM Piano": piano,
};
var overlayMaps = {
"Waymarked Trails": waymarked_trails,
"CyclOSM Lite": cyclosm_lite
};
L.control.layers(baseMaps, overlayMaps, { collapsed: true }).addTo(map);
// Set up hash plugin
var allMapLayers = {
'cyclosm': cyclosm,
'cyclosm_live': cyclosm_live,
'cyclosm_be': cyclosm_be,
'piano': piano,
'openstreetmap': osm,
'opencyclemap': ocm,
'opentopomap': otm,
'waymarkedtrails': waymarked_trails,
'cyclosmlite': cyclosm_lite,
};
L.hash(map, allMapLayers);
// Set up geocoder plugin
var geocoder = L.Control.geocoder({
defaultMarkGeocode: false,
position: 'topleft'
});
geocoder.on('markgeocode', function(e) {
map.fitBounds(e.geocode.bbox);
})
geocoder.addTo(map);
document.querySelector('button.leaflet-control-geocoder-icon').title = 'Search'
// Set up geolocation plugin
L.control.locate().addTo(map);
// Add a scale
L.control.scale().addTo(map);
// Set up routing / edit / help / legend buttons
L.easyButton('fa-route', function(btn, map) {
window.open('http://brouter.de/brouter-web/' + window.location.hash, '_blank');
}, 'Create an itinerary with BRouter').addTo(map);
L.easyButton('fa-edit', function(btn, map) {
window.open('https://www.openstreetmap.org/edit' + window.location.hash, '_blank');
}, 'Edit the map').addTo(map);
L.easyButton('fa-question', function(btn, map) {
window.open('legend.html', '_blank');
}, 'Legend').addTo(map);
L.easyButton('fa-info', function(btn, map) {
modal.open();
}, 'About').addTo(map);
// =============
// Handle legend
// =============
function handleResize() {
var shouldLegendOpen = true;
if (screen.width > 800) {
shouldLegendOpen = true;
} else {
shouldLegendOpen = false;
}
if (storageAvailable('localStorage') && window.localStorage.isLegendOpen !== undefined) {
shouldLegendOpen = JSON.parse(window.localStorage.isLegendOpen);
}
if (shouldLegendOpen) {
document.querySelector('#map').style.right = '300px';
document.querySelector('#legend .iframe').style.display = 'initial';
document.querySelector('#legend').style.width = '300px';
document.querySelector('#legend button').innerText = '❯';
} else {
document.querySelector('#map').style.right = '42px';
document.querySelector('#legend .iframe').style.display = 'none';
document.querySelector('#legend').style.width = '42px';
document.querySelector('#legend button').innerText = '❮';
}
}
handleResize();
window.addEventListener('resize', handleResize());
document.querySelector('#legend button').addEventListener('click', function (event) {
event.preventDefault();
if (document.querySelector('#legend button').innerText == '❮') {
if (storageAvailable('localStorage')) {
window.localStorage.isLegendOpen = JSON.stringify(true);
}
document.querySelector('#map').style.right = '300px';
document.querySelector('#legend .iframe').style.display = 'initial';
document.querySelector('#legend').style.width = '300px';
document.querySelector('#legend button').innerText = '❯';
} else {
if (storageAvailable('localStorage')) {
window.localStorage.isLegendOpen = JSON.stringify(false);
}
document.querySelector('#map').style.right = '42px';
document.querySelector('#legend .iframe').style.display = 'none';
document.querySelector('#legend').style.width = '42px';
document.querySelector('#legend button').innerText = '❮';
}
map.invalidateSize();
});
});
</script>
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, '//stats.cyclosm.org/tracker.js', 'fathom');
fathom('set', 'siteId', 'YVXBB');
fathom('trackPageview');
</script>
<!-- / Fathom -->
</body>
</html>