-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
427 lines (380 loc) · 12.6 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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.45.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.45.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.mapboxgl-popup {
font: 12px/20px 'Rockwell', Arial, Helvetica, sans-serif;
}
.mapboxgl-popup-close-button {
display:none;
}
.mapboxgl-popup-content{
padding:10px 15px 5px;
}
.map-overlay_legend {
position: absolute;
bottom: 0;
right: 0;
background: rgba(255, 255, 255, 0.8);
margin-right: 20px;
font-weight:bolder;
font:12px/18px 'Roboto', Arial, Helvetica, sans-serif !important;
overflow: auto;
border-radius: 3px;}
.map-overlay_title {
position: absolute;
Top: 12px;
left: 0;
background: rgba(255, 255, 255, 0.8);
margin-left: 20px;
font-weight:bolder;
font:30px/30px 'Roboto', Arial, Helvetica, sans-serif !important;
overflow: auto;
border-radius: 3px;}
.map-overlay_logo {
position: absolute;
bottom: 0;
left: 0;
margin-left: 20px;
margin-bottom:30px !important;
overflow: auto;
border-radius: 3px;
width:200px}
a.mapboxgl-ctrl-logo {
width: 85px;
height: 21px;
margin: 0 0 -3px -3px;
display: none;
background-repeat: no-repeat;
cursor: pointer;
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiP…gsOS40MyAxMC42Niw4LjUzIDExLjU2LDYuNjYgMTIuNDcsOC41MyAgICIvPjwvZz48L3N2Zz4=);
}
#title {
padding: 0px 10px 10px 10px;
box-shadow: 0 1px 2px rgba(0,0,0,0.10);
line-height: 18px;
height: 57px;
width: 602px;
overflow:hidden;
}
#legend {
padding: 10px;
box-shadow: 0 1px 2px rgba(0,0,0,0.10);
line-height: 18px;
height: 320px;
margin-bottom: 40px;
width: 339px;
overflow:hidden;
}
.legend-key {
display:inline-block;
border-radius: 20%;
width: 10px;
height: 10px;
margin-right: 5px;
font:12px/18px 'Roboto', Arial, Helvetica, sans-serif !important;
}
#image{
float:left;
}
#text{
float:right;
max-width:250px;
margin-left:0px;
}
iframe {
border-width:0px !important;
width:100%;
height:176px
}
.list-group {padding-left:0px;margin-bottom:0px}
.list-group-item {padding-left:6px;
}
.list-group-item_subtext {
padding-left:20px;
font:12px/15px 'Roboto', Arial, Helvetica, sans-serif !important;
}
.sg-question-options{
padding-left:0px !important
}
.sg-question-set{
height:129px !important;
}
.sg-question-title{
width:100% !important
}
#header{
font-weight:bolder;
font:20px/20px 'Roboto', Arial, Helvetica, sans-serif !important;
display: inline-block;
word-break: break-word;
width: 362px;
}
.sg-body {
font-family: 'Roboto', Arial, Helvetica, sans-serif !important;
font-size: 16px;
font-weight: 400;
color: #000000;
background-color: rgba(239,239,239,0)!important;
height:140px !important;
overflow: hidden !important;
}
.sg-body .sg-page-1 .sg-pageid-1 .sg-webkit .sg-ltr .sg-replace-icons {
padding-bottom:0px !important;
overflow: hidden !important;
}
#sgE-3698230-1-2-element {
height: 50px;
padding: 0px;
border: 1px solid;
}
.sg-input-essay{
border:1px solid #000000;
}
#sgbody-3698230{
padding-bottom:0px !important;
overflow: hidden !important;
}
.sg-survey .sg-survey-form {
height: 140px !important;
overflow: hidden !important;
}
.sg-content {
padding: 0em 30px 2em !important;
margin: auto !important;
overflow: hidden !important;
}
#sg-skipnav-target {
padding-top: 0px !important;
overflow: hidden !important;
}
img{
width:100%}
</style>
</head>
<body>
<div id='map'></div>
<div class='map-overlay_title' id='title'>Napa Countywide Bicycle Plan Update
<br>Proposed Bicycle Facility Recommendations</div>
<div class='map-overlay_logo' id='logo'><img src="https://raw.githubusercontent.com/tooledesign/napabikeplan/master/NVTA_name_high_res.png" style = "width:100%"></div>
<div class='map-overlay_legend' id='legend'>
<b>Instructions</b>
<p style="margin-top:0px">Click on the street recommendation line (zoom in for greater detail and street names) to leave your comment.<br> <i>Bike facility descriptions can be found <a href="https://tooledesign.github.io/napabikeplan/facilitydescriptions.html"target="blank">here</a>.</i></p>
<p style="margin-top:0px">Think a street should have a bike facility but there isn't one shown? <br>
<a href="https://www.surveygizmo.com/s3/4412953/Napa-County-Bike-Plan-AdditionalFacilities">Let us know.</a> </p>
<b>Facilities</b><br>
<img src="https://raw.githubusercontent.com/tooledesign/napabikeplan/master/napalegend3.svg?sanitize=true">
</div>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoidG9vbGVkZXNpZ24xIiwiYSI6ImNpeXZwdGZ1YTAwMmUyd3FhZGFtaHB1a2kifQ.7YtZldK9lYWNVfrZabNlbQ';
if (!mapboxgl.supported()) {
alert('Your browser does not support Mapbox GL');
} else {
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/tooledesign1/cji99oiov6yah2rpreel7y8my',
center: [-122.3257,38.529],
zoom: 9.11,
hash: true
})};
map.on('load', function () {
// define layer names
map.addSource("recs", {
"type": "geojson",
"data": "https://raw.githubusercontent.com/tooledesign/napabikeplan/master/proposedfacilities_20180611_4.geojson"
});
map.addSource("corridors", {
"type": "geojson",
"data": "https://raw.githubusercontent.com/tooledesign/napabikeplan/master/corridorstudy_20180611.geojson"
});
map.addLayer({
"id": "facilities_hover",
"type": "line",
"source": "recs",
"layout": {
"line-join": "round",
"line-cap":"round"
},
"paint": {
"line-color": {
"property": "label",
"type":"categorical",
"stops": [
["Class I Multi Use Path","#b3006e"],
["Vine Trail","#00b40f"],
["Class II Bike Lane","#00a0d1"],
["Class III Rural Bike Route","#e4cf1d"],
["Class III Bike Boulevard","#ff7f00"],
["Class IV Separated Bike Lane","#8116f4"]
]
},
"line-opacity": 1,
"line-width": {base:1.2,
stops: [[0, 2],[22, 22]]
},
},
"filter":["==", "id", ""]
},'waterway-label');
map.addLayer({
"id": "corridor_hover",
"type": "line",
"source": "corridors",
"layout": {
"line-join": "round",
"line-cap":"round"
},
"paint": {
"line-color": {
"property": "label",
"type":"categorical",
"stops": [
["Corridor Study","#b2b2b2"],
]
},
"line-opacity": .5,
"line-width": {base:1.2,
stops: [[0, 10],[22, 100]]
},
},
"filter":["==", "id", ""]
},'admin-2-boundaries-dispute');
map.addLayer({
"id": "facilities",
"type": "line",
"source": "recs",
"layout": {
"line-join": "round",
"line-cap":"round"
},
"paint": {
"line-color": {
"property": "label",
"type":"categorical",
"stops": [
["Class I Multi Use Path","#b3006e"],
["Vine Trail","#00b40f"],
["Class II Bike Lane","#00a0d1"],
["Class III Rural Bike Route","#e4cf1d"],
["Class III Bike Boulevard","#ff7f00"],
["Class IV Separated Bike Lane","#8116f4"]
]
},
"line-opacity": 1,
"line-width": {base:1.2,
stops: [[0, 1],[22, 15]]
},
"line-dasharray":[.5,2],
}},'waterway-label');
map.addLayer({
"id": "corridors",
"type": "line",
"source": "corridors",
"layout": {
"line-join": "round",
"line-cap":"round"
},
"paint": {
"line-color": {
"property": "label",
"type":"categorical",
"stops": [
["Corridor Study","#b2b2b2"],
]
},
"line-opacity": .5,
"line-width": {base:1.2,
stops: [[0, 5],[22, 60]]
},
}},'admin-2-boundaries-dispute');
// var layers = ['Vine Trail','Class I Multi Use Path', 'Class II Bike Lane', 'Class III Bike Boulevard','Class III Rural Bike Route','Class IV Separated Bike Lane','Corridor Study'];
// var colors = ['#00b40f', '#b3006e', '#00a0d1','#ff7f00','#fdc34e','#8116f4','#b2b2b2'];
// create legend
// for (i=0; i<layers.length; i++) {
// var layer = layers[i];
// var color = colors[i];
// var item = document.createElement('div');
// var key = document.createElement('span');
/// key.className = 'legend-key';
// key.style.backgroundColor = color;
// var value = document.createElement('span');
/// value.innerHTML = layer;
// item.appendChild(key);
// item.appendChild(value);
// legend.appendChild(item);
// };
map.on('click', function(e) {
var features = map.queryRenderedFeatures(e.point, { layers: ['facilities'] });
// if the features have no info, return nothing
if (!features.length) {
return;
}
var feature = features[0];
// Populate the popup and set its coordinates
// based on the feature found
var popup = new mapboxgl.Popup({keepInView:true})
.setLngLat(e.lngLat)
.setHTML('<div id="popup" class="popup" style="z-index: 10;">' +
'<div id="text">' +
'<ul class="list-group">' + '<ul class="list-group-item" id = "header">' + feature.properties['label'] + "</ul>" +
'<ul style="padding-left:0px">' + '<iframe src="'+ feature.properties['url'] +'style="width:300px; border-width:0px !important" "frameborder="0"></iframe>' + " </ul>" + '</ul></div> </div>')
.addTo(map);
});
map.on('click', function(e) {
var features = map.queryRenderedFeatures(e.point, { layers: ['corridors'] });
// if the features have no info, return nothing
if (!features.length) {
return;
}
var feature = features[0];
// Populate the popup and set its coordinates
// based on the feature found
var popup = new mapboxgl.Popup({keepInView:true})
.setLngLat(e.lngLat)
.setHTML('<div id="popup" class="popup" style="z-index: 10;">' +
'<div id="text">' +
'<ul class="list-group">' + '<ul class="list-group-item" id = "header">' + feature.properties['label'] + "</ul>" +
'<ul style="padding-left:0px">' + '<iframe src="'+ feature.properties['url'] +'style="width:300px; border-width:0px !important" "frameborder="0"></iframe>' + " </ul>" + '</ul></div> </div>')
.addTo(map);
});
map.on('mouseenter', 'facilities', function () {
map.getCanvas().style.cursor = 'pointer';
});
map.on('mouseenter', 'corridors', function () {
map.getCanvas().style.cursor = 'pointer';
});
// Change it back to a pointer when it leaves.
map.on('mouseleave', 'facilities', function () {
map.getCanvas().style.cursor = '';
});
// Change it back to a pointer when it leaves.
map.on('mouseleave', 'corridors', function () {
map.getCanvas().style.cursor = '';
});
// When the user moves their mouse over the states-fill layer, we'll update the filter in
// the state-fills-hover layer to only show the matching state, thus making a hover effect.
map.on("mousemove", "facilities", function(e) {
map.setFilter("facilities_hover", ["==", "id", e.features[0].properties.id]);
});
// // Reset the state-fills-hover layer's filter when the mouse leaves the layer.
map.on("mouseleave", "facilities", function() {
map.setFilter("facilities_hover", ["==", "id", ""]);
});
map.on("mousemove", "corridors", function(e) {
map.setFilter("corridor_hover", ["==", "id", e.features[0].properties.id]);
});
// // Reset the state-fills-hover layer's filter when the mouse leaves the layer.
map.on("mouseleave", "corridors", function() {
map.setFilter("corridor_hover", ["==", "id", ""]);
});
});
</script>
</body>
</html>
</html>