-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
922 lines (815 loc) · 30 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
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
<!DOCTYPE html>
<html lang="en-US">
<head>
<style>
body { margin: 0; padding: 0; }
#map { position: absolute; top: 45px; bottom: 0; width: 100%; }
p {font-family: Arial, Helvetica, sans-serif; margin-left: 3%; margin-right: 3%;}
</style>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-132447077-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-132447077-2');
</script>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<meta name="Description"
content="NYC Online Bike Map with NYC Bike Lanes, Greenways, Openstreets, Citi Bike, Protected Bike Paths and More. Updated May 2022.">
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@700&display=swap" rel="stylesheet" defer>
<!-- <script src='https://api.mapbox.com/mapbox-gl-js/v1.8.1/mapbox-gl.js'></script> -->
<script src='mapbox-gl.js'></script>
<!-- <script src="modernizr.js"></script> -->
<!-- Favicons: -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/icons/apple-touch-icon-144x144.png" />
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="images/icons/apple-touch-icon-152x152.png" />
<link rel="icon" type="image/png" href="images/icons/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="images/icons/favicon-16x16.png" sizes="16x16" />
<meta name="application-name" content="NYC Bike Map"/>
<meta name="msapplication-TileColor" content="#FFFFFF" />
<meta name="msapplication-TileImage" content="images/icons/mstile-144x144.png" />
<script async defer src="https://buttons.github.io/buttons.js"></script>
</head>
<title>NYC Bike Map</title>
<body style="background-color: white">
<style>
#menu {
position: absolute;
background: #efefef;
padding: 10px;
font-family: 'Open Sans', sans-serif;
font-size: larger;
}
</style>
<link href='mapbox-gl.css' rel='stylesheet'/>
<script src="mapbox-gl-directions.js"></script>
<link rel="stylesheet" href="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-directions/v4.1.0/mapbox-gl-directions.css" type="text/css">
<!-- <script>
(function() {
if(Modernizr.touchevents === false) {
var theScript = document.createElement('script');
theScript.type = 'text/javascript';
theScript.src = 'directions.js';
var head = document.getElementsByTagName('head')[0];
body.appendChild(theScript);
}
})();
</script> -->
<link rel="stylesheet" href="directions.css" type="text/css" defer/>
<!-- Menu -->
<ul class="nav-mobile">
<li class="unselectable">NYC Bike Map</li>
<li style= "font-family: 'Roboto', sans-serif;" class="menu-container">
<input id="menu-toggle" type="checkbox">
<label for="menu-toggle" class="menu-button">
<svg class="icon-open" viewBox="0 0 24 24"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"></path></svg>
<svg class="icon-close" viewBox="0 0 100 100">
<path d="M83.288 88.13c-2.114 2.112-5.575 2.112-7.69 0L53.66 66.188c-2.113-2.112-5.572-2.112-7.686 0l-21.72 21.72c-2.114 2.113-5.572 2.113-7.687 0l-4.693-4.692c-2.114-2.114-2.114-5.573 0-7.688l21.72-21.72c2.112-2.115 2.112-5.574 0-7.687L11.87 24.4c-2.114-2.113-2.114-5.57 0-7.686l4.842-4.842c2.113-2.114 5.57-2.114 7.686 0l21.72 21.72c2.114 2.113 5.572 2.113 7.688 0l21.72-21.72c2.115-2.114 5.574-2.114 7.688 0l4.695 4.695c2.112 2.113 2.112 5.57-.002 7.686l-21.72 21.72c-2.112 2.114-2.112 5.573 0 7.686L88.13 75.6c2.112 2.11 2.112 5.572 0 7.687l-4.842 4.84z"/>
</svg>
</label>
<ul class="menu-sidebar">
<li>
<input type="checkbox" id="sub-one" class="submenu-toggle">
<label class="submenu-label" for="sub-one">About NYC Bike Map</label>
<div class="arrow right">›</div>
<ul class="menu-sub" style = "padding: 0px;
overflow-y: auto;" >
<li class="menu-sub-title">
<label class="submenu-label" for="sub-one">Back</label>
<div class="arrow left">‹</div>
</li>
<div class = "about-section">
<strong><p style = "font-size: larger;">NYC Bike Map is a free interactive bike network map for New York City that combines information from NYC OpenData, Citi Bike and other sources. It currently displays the NYC Bike lane network, bike racks, bike shelters, Citi Bike docks, Oonee Pods and Bike tips + hazards.
</p> </strong>
<h1>Who made NYC Bike Map?</h1>
<p>NYC Bike Map was created and is under development by <a style=" display: inline; text-decoration: none; color:navy;" class ="about-section-link" href="https://todd-lm.github.io"> Todd Lee-Millstein</a>. It is also open-source so anybody is able to contribute to it if they want.</p>
<h1>Why should I use NYC Bike Map?</h1>
<p>Currently, there is no good interactive bike map for NYC. DOT only provides a PDF version of the NYC bike network which lacks a lot of functionality. Google Maps also has an interactive version of the bike map but it doesn't provide the same depth of information that NYC Bike Map has.</p>
<h1>Where does NYCBikeMap get its data from?</h1>
<p>NYCBikeMap gets its data from a variety of different sources including NYC Open Data, Citi Bike and more. This is a full list of all the data used:
<ul>
<li><a href="https://data.cityofnewyork.us/Transportation/Bicycle-Routes/7vsa-caz7">NYC Bicycle Routes</a></li>
<li><a href="https://data.cityofnewyork.us/NYC-BigApps/Citi-Bike-System-Data/vsnr-94wk">Citi Bike System Data</a></li>
<li><a href="https://data.cityofnewyork.us/Health/Open-Street-Locations-Map-/6q9w-6svb">NYC Open Street Locations</a></li>
<li><a href="https://www.ooneepod.com">Oonee Pod Locations</a></li>
</ul>
<h1>Can I advertise on NYC Bike Map?</h1>
<p>Yes! Contact us for more information.</p>
<h1>How can I support NYC Bike Map?</h1>
<p>We currently don't have any operating costs but if you would like to contribute to the code, you can do so at <a href ="https://github.com/todd-lm/nycbikemap">https://github.com/todd-lm/nycbikemap</a> Your feedback is also extremley important to the development of NYC Bike Map so if you have any, please let us know!</p>
<h1>What new features are coming to NYC Bike Map?</h1>
<p>NYC Bike Map is still under development so new features are constantly being added. If you would like to see any features added or you have any suggestions, let us know! Here is a broad list of features that will be added, in no particular order:</p>
<ul>Live Citi Bike Intregration</ul>
<ul>Custom Filtering</ul>
<ul>Native IOS and Andriod Apps</ul>
<ul>Dedicated host url</ul>
<ul>Improved Navigation</ul>
<ul>Saved locations</ul>
<ul>Expanded bike parking information</ul>
</div>
</ul>
</li>
<li>
<input type="checkbox" id="sub-two" class="submenu-toggle">
<label class="submenu-label" for="sub-two">Legend</label>
<div class="arrow right">›</div>
<ul class="menu-sub" style = "padding: 0px;
overflow-y: auto; ">
<li class="menu-sub-title">
<label class="submenu-label" for="sub-two">Back</label>
<div class="arrow left">‹</div>
</li>
<h1 style="margin:3%;">Protected Bike Lanes:</h1>
<picture>
<source srcset="images/protected.webp" type="image/webp">
<source type="image/jp2" srcset="images/protected.jp2">
<img class = "legend-image" src = "images/protected.png" height="40%" width="70%">
</picture>
<p style = "line-height: normal;"> Protected Bike Lanes include all dedicated bike lanes that are seperated from vehicular traffic.</p>
<h1 style="margin:3%;">On-Street Bike Lanes:</h1>
<picture>
<source srcset="images/standard.webp" type="image/webp">
<source type="image/jp2" srcset="images/standard.jp2">
<img class = "legend-image" src = "images/standard.png" height="30%" width="80%">
</picture>
<p style = "line-height: normal;">Standard Bike lanes that mix with vehicular traffic.</p>
<h1 style="margin:3%;">Sharrows:</h1>
<picture>
<source srcset="images/sharrows.webp" type="image/webp">
<source type="image/jp2" srcset="images/sharrows.jp2">
<img class = "legend-image" src = "images/sharrows.png" height="30%" width="80%">
</picture>
<p style = "line-height: normal;">Marked routes mixed with vehicular traffic.</p>
<h1 style="margin:3%;">Temporary Bike Lanes:</h1>
<picture>
<source srcset="images/templanes.webp" type="image/webp">
<source type="image/jp2" srcset="images/templanes.jp2">
<img class = "legend-image" src = "images/templanes.jp2" height="30%" width="80%">
</picture>
<p style = "line-height: normal;">Temporary bike lanes were implemented during the Covid-19 pandemic by NYC DOT. The conditions of these lanes are oftentimes variable and many have not been maintained properly.</p>
<h1 style="margin:3%;">Open Streets:</h1>
<picture>
<source srcset="images/openstreets.webp" type="image/webp">
<source type="image/jp2" srcset="images/openstreets.jp2">
<img class = "legend-image" src = "images/openstreets.png" height="30%" width="80%">
</picture>
<p style = "line-height: normal;">Open streets are streets that were closed to vehicular traffic during the Covid-19 pandemic. Some open streets are not closed to vehicular traffic at all times.</p>
<h1 style="margin:3%;">Citi Bike Docks:</h1>
<picture>
<source srcset="images/citibike.webp" type="image/webp">
<source type="image/jp2" srcset="images/citibike.jp2">
<img class = "legend-image" src = "images/citibike.png" height="30%" width="80%">
</picture>
<p style = "line-height: normal;">Citi bike dock locations, updated July 2021. Learn more about Citi Bike <a style="color: blue;" rel="noopener" target="_blank" href="https://www.citibikenyc.com/how-it-works">here.</a></p>
<h1 style="margin:3%;">Bike Shelters:</h1>
<picture>
<source srcset="images/sheltered.webp" type="image/webp">
<source type="image/jp2" srcset="images/sheltered.jp2">
<img class = "legend-image" src = "images/sheltered.png" height="20%" width="40%">
</picture>
<p style = "line-height: normal;">There are a few dedicated bike shelter locations located throughout the city. Find out more <a style = "color:blue" rel="noopener" target= "_blank" href="https://www1.nyc.gov/html/dot/html/bicyclists/bicycleparking.shtml">here.</a></p>
<h1 style="margin:3%;">Standard Bike Racks:</h1>
<picture>
<source srcset="images/rack.webp" type="image/webp">
<source type="image/jp2" srcset="images/rack.jp2">
<img class = "legend-image" src = "images/rack.png" height="30%" width="60%">
</picture>
<p style = "line-height: normal;">Publicly availible bike racks with capacity.</p>
<h1 style="margin:3%;">ADA Acessible Stations:</h1>
<picture>
<source srcset="images/elevators.webp" type="image/webp">
<source type="image/jp2" srcset="images/elevators.jp2">
<img class = "legend-image" src = "images/elevators.png" height="30%" width="60%">
</picture>
<p style = "line-height: normal;">Stations with ADA acessible facilities. This usually means it's a lot easier to take your bike on the train. Learn more about taking your bike on public transit <a style="color: blue;" rel="noopener" target="_blank" href="https://new.mta.info/guides/bikes">here.</a></p>
<h1 style="margin:3%;">Walk Bike:</h1>
<picture>
<source srcset="images/walkbike.webp" type="image/webp">
<source type="image/jp2" srcset="images/walkbike.jp2">
<img class = "legend-image" src = "images/walkbike.png" height="30%" width="60%">
</picture>
<p style = "line-height: normal;">Areas where you are supposed to dismount and "walk" your bike.</p>
<h1 style="margin:3%;">Stairs:</h1>
<picture>
<source srcset="images/stairs.webp" type="image/webp">
<img class = "legend-image" src = "images/stairs.png" height="30%" width="60%">
</picture>
<p style = "line-height: normal;">Be prepared to carry your bike up/down stairs.</p>
<h1 style="margin:3%;">Steep:</h1>
<picture>
<source srcset="images/steep.webp" type="image/webp">
<img class = "legend-image" src = "images/steep.png" height="30%" width="60%">
</picture>
<p style = "line-height: normal;">Steep areas: use caution when riding downhill and in inclement weather conditions.</p>
<h1 style="margin:3%;">Important Information:</h1>
<picture>
<source srcset="images/hazard.webp" type="image/webp">
<img class = "legend-image" src = "images/hazard.png" height="30%" width="60%">
</picture>
<p style = "line-height: normal;">Important Information about an area.</p>
<h1 style="margin:3%;">Information:</h1>
<picture>
<source srcset="images/info.webp" type="image/webp">
<img class = "legend-image" src = "images/info.png" height="30%" width="60%">
</picture>
<p style = "line-height: normal;">Information about an area.</p>
<strong><p style = "line-height: normal; padding-bottom: 10%;">Want to see more icons? Let us know <a style="color: blue;" rel="noopener" target="_top" href="mailto:todd@nycbikemap.nyc">here.</a></p> </strong>
</ul>
</li>
<!-- <li> -->
<!-- <input type="checkbox" id="sub-three" class="submenu-toggle">
<label class="submenu-label" for="sub-three">Follow us on social media!</label>
<div class="arrow right">›</div>
<ul class="menu-sub">
<li class="menu-sub-title">
<label class="submenu-label" for="sub-three">Back</label>
<div class="arrow left">‹</div>
</li>
<li><a target = "_blank" rel="noopener" href="https://github.com/todd-lm/nycbikemap">Github</a></li>
<li><a href="https://www.producthunt.com/posts/nyc-bike-map?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-nyc-bike-map" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=189060&theme=light" alt="NYC Bike Map - The most powerful open source bike map for NYC. | Product Hunt Embed" style="width: 250px; height: 54px;" width="250px" height="54px" /></a></li> -->
<!-- <li><a href="#">Twitter</a></li> -->
<!-- </ul> -->
<!-- </li> -->
<!-- <li><a href="about.html">Learn more about NYC Bike Map</a></li> -->
<a href="https://twitter.com/nyc_bike_map?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-size="large" data-dnt="true" data-show-count="false">Follow @nyc_bike_map</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<!-- Place this tag where you want the button to render. -->
<a class="github-button" href="https://github.com/todd-lm/nycbikemap" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star tpixelminer/nycbikemap on GitHub">Star On Github</a>
<div class="content-button">
<a style = "font-size:16px; display: inline; line-height: 0px; color: white; width:60%" ripple="ripple" ripple-color="#FFF"target="_top" href="mailto:todd@nycbikemap.nyc">Contact</a>
</div>
<p>NYC Bike Map v1.3.1</p>
<footer>
<small>© 2021 Todd Lee-Millstein</small>
</footer>
</ul>
</li>
</ul>
<div id='map'></div>
<div id="menu">
<input id="standard" type="radio" name="rtoggle" value="standard" checked="checked">
<!-- See a list of Mapbox-hosted public styles at -->
<!-- https://docs.mapbox.com/api/maps/styles/#mapbox-styles -->
<label for="satellite-v9">Standard</label>
<input id="3D" type="radio" name="rtoggle" value="3D">
<label for="light-v10"><strong><i>HillView</i></strong></label>
</div>
<script>
//Check to see if browser is supported
if (!mapboxgl.supported()) {
alert('Your browser does not support NYC Bike Map');
} else {
mapboxgl.accessToken = 'pk.eyJ1IjoidG9kZGxtIiwiYSI6ImNrN3RuYzRjaDB2Zm4zZm5yOW42Ymt0cDQifQ.x1fVFY167sQIIxb3a2zMpQ';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/toddlm/ck7tne8954uck1iplsky5igqx?optimize=true',
minZoom: '9',
attributionControl: false,
pitch: 0
});
}
// Add geolocate control to the map.
map.addControl(
new mapboxgl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true
},
trackUserLocation: true
})
);
map.addControl(new mapboxgl.AttributionControl({
compact: true,
}));
//Add Fullscreen
map.addControl(new mapboxgl.FullscreenControl());
//Add Map Navigation
map.addControl(new mapboxgl.NavigationControl());
const layerList = document.getElementById('menu');
const inputs = layerList.getElementsByTagName('input');
var terrainLoaded = false;
for (const input of inputs) {
input.onclick = (layer) => {
const layerId = layer.target.id;
if (layerId == "3D") {
if(terrainLoaded == false){
map.addSource('mapbox-dem', {
'type': 'raster-dem',
'url': 'mapbox://mapbox.mapbox-terrain-dem-v1',
'tileSize': 512,
'maxzoom': 14
});
map.addLayer({
'id': 'sky',
'type': 'sky',
'paint': {
'sky-type': 'atmosphere',
'sky-atmosphere-sun': [0.0, 0.0],
'sky-atmosphere-sun-intensity': 15
}
});
terrainLoaded = true;
}
// add the DEM source as a terrain layer with exaggerated height
map.setTerrain({ 'source': 'mapbox-dem', 'exaggeration': 8 });
// add a sky layer that will show when the map is highly pitched
map.setPitch(65);
}
else {
map.setTerrain({ 'source': 'mapbox-dem', 'exaggeration': 0 });
map.setPitch(0);
}
};
}
var directions = new MapboxDirections({
accessToken: mapboxgl.accessToken,
profile: 'mapbox/cycling',
profileSwitcher: false,
alternatives: true,
controls: {
profileSwitcher: false,
instructions: false
},
geocoder: {
country: "US",
proximity: [-73.987865,40.748297]
}
});
// add to your mapboxgl map
map.addControl(directions, 'bottom-right');
//westlimit=c; southlimit=40.356765; eastlimit=-73.582462; northlimit=40.977582
// Oonee Markers:
var popupbklyn = new mapboxgl.Popup({ offset: 25 }).setHTML(
'<p><strong>Oonee Pod - Atlantic Terminal</strong></p> <picture> <source srcset="images/ooneepodimage.webp" type="image/webp"> <source type="image/jp2" srcset="images/ooneepodimage.jp2"> <img src = "images/ooneepodimage.jpeg" height="40%" width="70%"></picture> <p>Oonee is a secure public bike parking hub. Learn more about this Oonee Pod at <a target = "_blank" href ="https://www.ooneepod.com/atlantic-terminal">https://www.ooneepod.com/atlantic-terminal</a></p> '
);
var popupjc = new mapboxgl.Popup({ offset: 25 }).setHTML(
'<p><strong>Oonee Pod - Journal Square</strong></p> <picture> <source srcset="images/ooneepodimagejc.webp" type="image/webp"> <source type="image/jp2" srcset="images/ooneepodimagejc.jp2"> <img src = "images/ooneepodimagejc.jpg" height="40%" width="70%"></picture> <p>Oonee is a secure public bike parking hub. Learn more about this Oonee Pod at <a target = "_blank" href ="https://www.ooneepod.com/journal-square">https://www.ooneepod.com/journal-square</a></p> '
);
// create DOM element for the marker
var ooneebklyn = document.createElement('div');
ooneebklyn.id = 'marker';
var ooneejc = document.createElement('div');
ooneejc.id = 'marker';
// create the marker
new mapboxgl.Marker(ooneebklyn)
.setLngLat([-73.975693, 40.683709])
.setPopup(popupbklyn) // sets a popup on this marker
.addTo(map);
new mapboxgl.Marker(ooneejc)
.setLngLat([-74.063588, 40.731881,])
.setPopup(popupjc) // sets a popup on this marker
.addTo(map);
map.on('zoom', function() {
if (map.getZoom() > 11.25) {
ooneebklyn.style.display = 'block';
ooneejc.style.display = 'block';
} else {
ooneebklyn.style.display = 'none';
ooneejc.style.display = 'none';
}
});
map.on('load', function() {
map.addSource('places', {
'type': 'geojson',
'data': {
'type': 'FeatureCollection',
'features': [
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Orchard Beach Boardwalk</strong></p> <p>Bicycles Permitted 6am – 10am only (Memorial Day to October 1) <a class="popup-link" href="https://www.nycgovparks.org/parks/pelham-bay-park/facilities/beaches" target="_blank">https://www.nycgovparks.org/parks/pelham-bay-park/facilities/beaches</a></p>',
'icon': 'hazard'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.793106, 40.866276]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Governors Island</strong></p> <p>Bike-friendly destination featuring The Hills and seven miles of car-free biking with spectacular views of Lower Manhattan, Brooklyn, and New York Harbor. </p><p>Open to the public 7 days a week from May 1 – October 1. </p><p> For hours of operation, event information, and Manhattan, Brooklyn, and NYC Ferry schedules and fare information, visit <a class="popup-link" href="https://www.govisland.com" target="_blank">https://www.govisland.com</a></p>',
'icon': 'info'
},
'geometry': {
'type': 'Point',
'coordinates': [-74.022017, 40.68744]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Floyd Bennet Field</strong></p> <p>Floyd Bennett Field allows visitors to bike the historic runways and hike in the North Forty Natural Area. With a permit, visitors may camp in one of New York City’s only campgrounds, fish, and boat in Jamaica Bay.</p> <a class="popup-link" href="https://www.nps.gov/gate/planyourvisit/index.htm" target="_blank">https://www.nps.gov/gate/planyourvisit/index.htm</a>',
'icon': 'info'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.889365, 40.593132]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Manhattan Beach Boardwalk</strong></p> <p>Bicycles Permitted 6am – 10am Memorial Day to October 1. Bicycles Permitted 6am - 9pm all other times <a class="popup-link" href="https://www.nycgovparks.org/parks/manhattan-beach-park" target="_blank">https://www.nycgovparks.org/parks/manhattan-beach-park</a></p>',
'icon': 'hazard'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.944136, 40.57647]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Coney Island Boardwalk</strong></p> <p>Bicycles Permitted 6am – 10am Memorial Day to October 1. Bicycles Permitted 6am - 9pm all other times <a class="popup-link" href="https://www.nycgovparks.org/parks/coney-island-beach-and-boardwalk" target="_blank">https://www.nycgovparks.org/parks/coney-island-beach-and-boardwalk</a></p>',
'icon': 'hazard'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.968759, 40.573951]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>High Bridge Hours</strong></p> <p>Summer: 7am-8pm </p> <p> Winter: 7am-7pm</p>',
'icon': 'hazard'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.930183, 40.8423]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Silver Lake Park Auto-Free Hours</strong></p> <p>Friday 5pm to Monday 7am</p> <p>Holidays 5pm day before 7am day after.</p>',
'icon': 'hazard'
},
'geometry': {
'type': 'Point',
'coordinates': [-74.097462, 40.627894]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Steep</strong></p>',
'icon': 'steep'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.911853, 40.896192]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Steep</strong></p>',
'icon': 'steep'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.90747, 40.902132]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.922367, 40.877683]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.911037, 40.873675]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.9149, 40.862706]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.927946, 40.846703]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.820915, 40.869067]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.81568, 40.862219]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.933761, 40.828115]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.936186, 40.828651]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.933311, 40.819461]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.933053, 40.814037]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.927774, 40.800231]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.919063, 40.798769]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.926959, 40.779794]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.945713, 40.763397]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.945713, 40.763397]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p> <p>Use North Sidewalk </p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.837008, 40.762569]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p><p>Use West Sidewalk</p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.73723, 40.593165]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p><p>Use East Sidewalk</p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.819885, 40.591796]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Walk Bike</strong></p><p>Use West Sidewalk</p>',
'icon': 'walkbike'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.884945, 40.573283]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Stairs</strong></p>',
'icon': 'stairs'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.931202, 40.866941]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Stairs</strong></p>',
'icon': 'stairs'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.929384, 40.873813]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Stairs</strong></p>',
'icon': 'stairs'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.929384, 40.873813]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Steep</strong></p>',
'icon': 'steep'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.943738, 40.850818]
}
},
{
'type': 'Feature',
'properties': {
'description':
'<p><strong>Empire State Trail</strong></p><p>The 750-mile Empire State Trail welcomes bicyclists and hikers to explore New York State’s extraordinary experiences, people, and places.</p><p>Learn more about the trail<a href="https://empiretrail.ny.gov"> here.</a></p>',
'icon': 'estrail'
},
'geometry': {
'type': 'Point',
'coordinates': [-73.884779, 40.908040]
}
}
]
}
});
// Add a layer showing the places.
map.addLayer({
'id': 'places',
'type': 'symbol',
'source': 'places',
'layout': {
'icon-image': '{icon}', //{icon}
'icon-allow-overlap': true,
'icon-size': .32
}
});
// When a click event occurs on a feature in the places layer, open a popup at the
// location of the feature, with description HTML from its properties.
map.on('click', 'places', function(e) {
var coordinates = e.features[0].geometry.coordinates.slice();
var description = e.features[0].properties.description;
// Ensure that if the map is zoomed out such that multiple
// copies of the feature are visible, the popup appears
// over the copy being pointed to.
while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;
}
new mapboxgl.Popup()
.setLngLat(coordinates)
.setHTML(description)
.addTo(map);
});
// Change the cursor to a pointer when the mouse is over the places layer.
map.on('mouseenter', 'places', function() {
map.getCanvas().style.cursor = 'pointer';
});
// Change it back to a pointer when it leaves.
map.on('mouseleave', 'places', function() {
map.getCanvas().style.cursor = '';
});
});
</script>
</body>
</html>