-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·239 lines (208 loc) · 6.94 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
<!DOCTYPE html>
<html>
<head>
<title>Chicago Homicides</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
<link rel="stylesheet" type="text/css" href="css/own_style.css">
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
<script src="js/leaflet-hash.js"></script>
<script src="js/Autolinker.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
<style>
.custom-popup .leaflet-popup-content-wrapper {
background:#000000;
color:#fff;
font-size:16px;
line-height:24px;
border-radius:0 !important;
}
.custom-popup .leaflet-popup-content-wrapper a {
color:rgba(0,0,0,0.5);
}
.custom-popup .leaflet-popup-tip-container {
width:30px;
height:15px;
}
.leaflet-control-layers-expanded { background: #242426;
color: white;
border-radius:0 !important;
font-family: 'Ubuntu';
}
</style>
</head>
<body>
<div id ="container">
<div id="header">
<center>
<br><font color="black", size = 20>Chicago's History of Homicide</font></b><br>
<HR WIDTH="100%" Color = black>
<font color = black>Homicide rates in Chicago are currently some of the worst in the United States. This map adds context to todays figures by visualising a period in Chicago's History that saw gang related violence plague the city. Click on a neighborhood to see how the Homicide rate changed over the years and toggle the Poverty layer to see how it relates. </font>
<HR WIDTH="100%" Color = black>
Data courtesy of the Inter-University Consortium For Political and Social Research (ICPSR 6399)<br><br>
</center>
</div>
</div>
<style>
.custom .leaflet-popup-tip,
.custom .leaflet-popup-content-wrapper {
background: #e93434;
color: #ffffff;
}
</style>
<div class ='custom-popup' id="map">
<script src="data/exp_COmArea.js"></script>
<script>
var map = L.map('map').setView([41.85,-87.68],10);
var hash = new L.Hash(map);
var additional_attrib = 'created w. <a href="https://github.com/geolicious/qgis2leaf" target ="_blank">qgis2leaf</a> by <a href="http://www.geolicious.de" target ="_blank">Geolicious</a> & contributors<br>';
var basemap_0 = L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', {
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="http://cartodb.com/attributions">CartoDB</a>',
subdomains: 'abcd'
});
basemap_0.addTo(map)
var Legend = L.control({position: 'bottomright'});
Legend.onAdd = function(map) {
var div = L.DomUtil.create('div');
div.innerHTML += "<iframe src='"+ "http://i.imgur.com/MzeCw9u.jpg" +"' width='141' height='301' frameborder='0'></iframe>"
return div;
};
Legend.addTo(map);
function pop_COmArea(feature, layer) {
var popupContent = '<b><div align = "center">' + feature.properties.community + '<p><img src="' + feature.properties.Directory + '" />' + '<img src="images/scalebar.jpg">' + '<div font-size="16" align="left">' + feature.properties.Total + ' total Homicides from 1964-1995<p>' + 'The worst being ' + feature.properties.CheeseMaxYear + ' in which ' + feature.properties.MaxNum + ' people were killed.'
layer.bindPopup(popupContent, {
minWidth:344,
showOnMouseOver: true
});
}
function doStyleCOmArea(feature) {
if (feature.properties.Total >= 2.0 && feature.properties.Total <= 143.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#feebe2',
opacity: '1.0',
fillOpacity: '0.7',
}
}
if (feature.properties.Total >= 143.0 && feature.properties.Total <= 369.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#fbbfc1',
opacity: '1.0',
fillOpacity: '0.7',
}
}
if (feature.properties.Total >= 369.0 && feature.properties.Total <= 548.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#f886aa',
opacity: '1.0',
fillOpacity: '0.7',
}
}
if (feature.properties.Total >= 548.0 && feature.properties.Total <= 826.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#e34997',
opacity: '1.0',
fillOpacity: '0.7',
}
}
if (feature.properties.Total >= 826.0 && feature.properties.Total <= 1155.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#b61586',
opacity: '1.0',
fillOpacity: '0.7',
}
}
if (feature.properties.Total >= 1155.0 && feature.properties.Total <= 1445.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#7a0177',
opacity: '1.0',
fillOpacity: '0.7',
}
}
}
function doStyleCOmPoverty(feature) {
if (feature.properties.Poverty >= 2.0 && feature.properties.Poverty <= 15.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#feebe2',
opacity: '1.0',
fillOpacity: '0.7',
}
}
if (feature.properties.Poverty >= 15.0 && feature.properties.Poverty <= 26.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#fbbfc1',
opacity: '1.0',
fillOpacity: '0.7',
}
}
if (feature.properties.Poverty >= 26.0 && feature.properties.Poverty <= 34.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#f886aa',
opacity: '1.0',
fillOpacity: '0.7',
}
}
if (feature.properties.Poverty >= 34.0 && feature.properties.Poverty <= 41.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#e34997',
opacity: '1.0',
fillOpacity: '0.7',
}
}
if (feature.properties.Poverty >= 41.0 && feature.properties.Poverty <= 50.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#b61586',
opacity: '1.0',
fillOpacity: '0.7',
}
}
if (feature.properties.Poverty >= 50.0 && feature.properties.Poverty <= 66.0) {
return {
color: '#000000',
weight: '0.65',
fillColor: '#7a0177',
opacity: '1.0',
fillOpacity: '0.7',
}
}
}
var Povertylayer = new L.geoJson(exp_COmArea,{
onEachFeature: pop_COmArea,
style: doStyleCOmPoverty
});
var exp_COmAreaJSON = new L.geoJson(exp_COmArea,{
onEachFeature: pop_COmArea,
style: doStyleCOmArea
});
exp_COmAreaJSON.addTo(map)
var Baselayers = {
"Poverty": Povertylayer,
"Homicides": exp_COmAreaJSON
}
L.control.layers(Baselayers,null,{collapsed:false}).addTo(map);
</script>
</div>
</body>
</html>