-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
265 lines (215 loc) · 11.5 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
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- Enable responsiveness on mobile devices-->
<meta name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=1.0, user-scalable=yes" />
<title>
CMP-Safety · SFCTA Prospector
</title>
<!-- Icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/assets/sfcta-logo-144.png">
<link rel="shortcut icon" href="/assets/favicon.ico" type="image/vnd.microsoft.icon" />
<!-- RSS -->
<link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml">
<!-- LEAFLET -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<!-- LEAFLET PATTERN -->
<script src="https://teastman.github.io/Leaflet.pattern/leaflet.pattern.js"></script>
<!-- LEAFLET POLYLINE OFFSET -->
<script src="https://unpkg.com/leaflet-polylineoffset/leaflet.polylineoffset.js"></script>
<!-- LEAFLET TEXTPATH-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/leaflet.textpath.min.js"></script>
<!-- VUE -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<!-- use the latest vue-select release -->
<script src="https://unpkg.com/vue-select@latest"></script>
<link rel="stylesheet" href="https://unpkg.com/vue-select@latest/dist/vue-select.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vue-slider-component@latest/theme/antd.css">
<!-- MAPBOX GL -->
<script src='https://api.mapbox.com/mapbox-gl-js/v0.37.0/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v0.37.0/mapbox-gl.css' rel='stylesheet' />
<!-- SEMANTIC UI -->
<link rel="stylesheet" type="text/css" href="/assets/semantic/semantic.min.css">
<script
src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="/assets/semantic/semantic.min.js"></script>
<!-- MORRIS CHARTS -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>
<!-- CHROMA -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.3.6/chroma.min.js"></script>
<!-- D3 -->
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://d3js.org/d3-array.v1.min.js"></script>
<script src="https://d3js.org/d3-scale.v2.min.js"></script>
<!-- Simple Statistics -->
<script src='https://unpkg.com/[email protected]/dist/simple-statistics.min.js'></script>
<!-- IONICONS -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css">
<link rel="stylesheet" href="/assets/ionicons/leaflet.awesome-markers.css">
<script src="/assets/ionicons/leaflet.awesome-markers.min.js"></script>
<!-- Site CSS -->
<link rel="stylesheet" href="/assets/css/poole.css">
<link rel="stylesheet" href="/assets/css/syntax.css">
<link rel="stylesheet" href="/assets/css/sfcta.css">
<!-- GOOGLE ANALYTICS -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-100715169-13"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-100715169-13');
</script>
<!-- Google reCAPTCHA -->
<script src="https://www.google.com/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit" async defer></script>
<script src="https://unpkg.com/vue-recaptcha@^2/dist/vue-recaptcha.min.js"></script>
<!-- Page CSS -->
<link rel="stylesheet" href="/assets/css/main.css">
<link rel="stylesheet" href="/assets/css/standalone.css">
<!-- Google fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans|PT+Sans:400,400italic,700">
<link href="https://fonts.googleapis.com/css?family=Alegreya+SC:900i|Merriweather|Oleo+Script+Swash+Caps:700" rel="stylesheet">
</head>
<body>
<div class="container">
<div id="container">
<div id="slide-panel" v-bind:class="{ shrunken: isPanelHidden}">
<div id="layer-widgets">
<button class="ui tiny green icon button" v-on:click="clickedShowHide">
<i class="angle double icon" v-bind:class="{ left: isPanelHidden, right: !isPanelHidden}"></i>
</button>
</div>
</div>
<div id="panel" v-bind:class="{ shrunken: isPanelHidden}">
<div id="preheader">
<hr />
<h3 class="apptitle">SF Collisions Data from SWITRS</h3>
<div id="helpbar">
<button class="ui mini right labeled icon violet button" v-on:click="clickToggleHelp">
<i class="icon info"></i>
What is this?
</button>
<button class="ui mini right labeled icon violet button" v-on:click="this.window.open('https://www.sfcta.org/CMP-home','_blank')">
<i class="icon right arrow"></i>
Learn More
</button>
<hr />
</div>
<div id="picker">
<h5>CHOOSE TYPE:</h5>
<button v-for="item in vizlist" v-on:click="clickViz(item)" class="mini ui grey button"
v-bind:class="{
active: item == chosenIncidents,
'choose-type-bg-color-fatal': item == chosenIncidents && isFatalactive,
'choose-type-bg-color-nonfatal': item == chosenIncidents && isNonfactive,
'choose-type-bg-color-all': item == chosenIncidents && isAllactive
}">
${vizinfo[item]['TXT']}
</button>
<h5>CHOOSE SEVERITY:</h5>
<button class="mini ui grey button" v-on:click="pickFatal" v-bind:class="{ active: isFatalactive, 'choose-type-bg-color-fatal': isFatalactive }">
Fatal</button>
<button class="mini ui grey button" v-on:click="pickNonf" v-bind:class="{ active: isNonfactive, 'choose-type-bg-color-nonfatal': isNonfactive}">
Non-Fatal</button>
<button class="mini ui grey button" v-on:click="pickAll" v-bind:class="{ active: isAllactive, 'choose-type-bg-color-all': isAllactive}">
All</button>
<h5>MAP LAYERS</h5>
<p>Add additional geographic data to the map.</p>
<div class="ui colorepc toggle checkbox">
<input type="checkbox" value="epc2021_neighborhood" v-model="addLayers">
<label><h5>Equity Priority Communities Neighborhoods</h5></label>
</div>
<div class="ui colorhin toggle checkbox">
<input type="checkbox" value="hin2022" v-model="addLayers">
<label><h5>High Injury Network</h5></label>
</div>
<div class="ui colorsup toggle checkbox">
<input type="checkbox" value="sup_district_boundaries_2022" v-model="addLayers">
<label><h5>Supervisorial District Boundaries</h5></label>
</div>
<div class="ui colorpar toggle checkbox">
<input type="checkbox" value="sfparks" v-model="addLayers">
<label><h5>Major Parks</h5></label>
</div>
</div>
</div>
<div id="header">
<div id="stats-panel">
<hr style="margin-bottom:-5px;" />
<h3 style="font-size: 22px;">${chartTitle}</h3>
<h5 style="font-size: 12px">${chartSubTitle}</h5>
<div id="longchart">
<div class="ui active dimmer">
<div class="ui text loader">Loading</div>
</div>
</div>
</div>
</div>
<div class="logo">
<div class="pickers">
<h5>CHOOSE YEAR:</h5>
<vue-slider v-bind="timeSlider" v-model="sliderValue"
:dot-style="{
background: isFatalactive ? '#d15992' : isNonfactive ? '#ff6f4d' : isAllactive ? '#c31c4a' : 'yellow',
border: isFatalactive ? '#d15992' : isNonfactive ? '#ff6f4d' : isAllactive ? '#c31c4a' : 'yellow'
}"
:tooltip-style="{
background: isFatalactive ? '#d15992' : isNonfactive ? '#ff6f4d' : isAllactive ? '#c31c4a' : 'yellow',
border: isFatalactive ? '#d15992' : isNonfactive ? '#ff6f4d' : isAllactive ? '#c31c4a' : 'yellow'
}"
></vue-slider>
</div>
<hr />
<div>
<a class="agency-link" target="_blank" href="https://www.sfcta.org">
<img class="img-logo" src="/assets/SFCTA Logo dark-background.svg" width="80%" />
</a>
</div>
</div>
</div>
<div id="helpbox" v-if="showHelp" class="ui segment">
<div v-cloak=""> <!-- hides everything until Vue finished loading -->
<h2 style="margin-bottom:0px;">Bicycle and Pedestrian Collision Data</h2>
<hr style="margin-bottom:5px;margin-top:5px" />
This map is the observed pedestrian and bicycle collisions in San Francisco thanks to the Statewide Integrated Traffic Records System <a href="https://iswitrs.chp.ca.gov/Reports/jsp/index.jsp" target="_blank" rel="noopener noreferrer">(SWITRS)</a> database that included their latitude and longitude. The data was queried through the UC Berkeley SafeTREC Transportation Injury Mapping System <a href="https://tims.berkeley.edu/" target="_blank" rel="noopener noreferrer">(TIMS)</a>, which provides summaries, other visualizations, and an easy way to access SWITRS data.
<ul>
<li>Collision locations are snapped to the nearest intersection using the latitudes and longitudes given from SWITRS to the latitude and longitudes of the intersections in San Francisco.</li>
<li>Data is complete for years 2006-2021.</li>
<li>Data for 2022 is provisional and subject to change.</li>
</ul>
<h2 style="margin-top:10px; margin-bottom:0px;">How to use this map</h2>
<hr style="margin-bottom:5px;margin-top:5px" />
<ul>
<li>Select a collision type and severity to display it on the map for all years.</li>
<li>Move the year slider to map historic data.</li>
<li>Click on an intersection to update the chart with historic data for the clicked on intersection.</li>
<li>Click the arrow on the top right to hide the side panel.</li>
</ul>
<div style="margin-top:20px;">
<button v-on:click="clickToggleHelp" class="small ui right floated violet button">
OK
</button>
<button v-on:click="this.window.open('/assets/safety_sf_switrs_2022.zip')" class="small ui right labeled icon floated yellow button" style="margin-right:5px">
<i class="icon download"></i>
Download data (.zip)
</button>
<button v-on:click="this.window.open('https://www.sfcta.org/congestion','_blank')" class="small ui right floated basic violet button" style="margin-right:5px">
Learn more…
</button>
</div>
</div>
</div>
<div id="sfmap"></div>
</div>
<script type="application/javascript" src="/bundles/cmp_safety.js"></script>
</div>
</body>
</html>