-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
214 lines (177 loc) · 8.39 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Triad Routes & Food Sources</title>
<link rel="shortcut icon" type="image/jpg" href="assets/app.png"/>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.14.0/css/all.css">
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel='stylesheet'/>
<link href="https://fonts.googleapis.com/css?family=Lora" rel="stylesheet">
<link rel="stylesheet" href="https://leaflet.github.io/Leaflet.markercluster/dist/MarkerCluster.css" />
<link rel="stylesheet" href="https://leaflet.github.io/Leaflet.markercluster/dist/MarkerCluster.Default.css" />
<script src="https://leaflet.github.io/Leaflet.markercluster/dist/leaflet.markercluster-src.js"></script>
<style>
html, body, #map { width: 100%; height: 100%; margin: 0; background: #fff; }
.legend {
line-height: 40px;
font-size: 16px;
width: 190px;
color: #333333;
padding: 6px 8px;
background: white;
background: rgba(255,255,255,0.5);
box-shadow: 0 0 15px rgba(0,0,0,0.2);
border-radius: 5px;
font-family: 'Titillium Web', sans-serif;
}
.legend i {
width: 20px;
height: 20px;
float: left;
margin-right: 8px;
opacity: 0.9;
}
.legend img {
width: 16px;
height: 16px;
margin-right: 3px;
float: left;
}
.legend p {
font-size: 14px;
line-height: 20px;
margin: 0;
}
h1 {
position: absolute;
margin-top: 0;
top: 10px;
left: 350px;
font-size: 2em;
font-family: "Lora", serif;
color: #ffffff
letter-spacing: .04em;
padding: 10px 15px;
background: rgba(70, 107, 187, .45);
border: 1px solid grey;
border-radius: 3px;
z-index: 800;
}
h2 {
font-family: "Lora", serif;
letter-spacing: .04em;
}
section {
position: absolute;
bottom: 0;
left: 10px;
width: 280px;
margin: 20px auto;
padding: 0 15px;
background: rgba(256, 256, 256);
border: 1px solid grey;
border-radius: 3px;
z-index: 800;
}
</style>
<link href="https://fonts.googleapis.com/css?family=Titillium+Web" rel="stylesheet">
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-ajax/2.1.0/leaflet.ajax.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.3.4/chroma.min.js"></script>
<! -represent the variouss libraries for fonts and map web services (leaflet, jquery) ->
</head>
<body>
<h1>Triad Bus Routes and Food Sources</h1>
<section>
<h2>Hunger and Bus Route Solutions</h2>
<p> The Piedmont Triad Metropolitan Area is one of the largest population centers in the state, with newly-released 2021 census data estimating its total population to be <a href="https://www2.census.gov/programs-surveys/popest/tables/2020-2021/metro/totals/csa-est2021-pop.xlsx">1,705,315
people.</a>
Despite the continued economic growth of the area, there have been deep-seeded issues when it comes to food security, specifically with lower-income individuals.
Unfortunately, a report in 2011 named Winston-Salem the <a href="https://journalnow.com/news/local/hunger-study-calls-area-worst-in-u-s/article_136ce0c7-6763-5cb9-9e39-3f23dd0113ec.html">'worst metro area in the United States' in hunger metrics</a>, with 35% of households with kids that cannot afford adequate food.</p>
Due to the severity of this situation, the area's various municipalities and community leaders have stepped up to reduce hunger, and although the pandemic <a href="https://www.wxii12.com/article/more-children-in-forsyth-county-experience-food-insecurity/36832719">has stiffled some of this progress,</a> the infrastructure for food sources and access has increased, specifically with the bolstering of bus routes.</p>
<p> However, do these routes accomidate a large portion of those facing hunger issues? This interactive web map seeks to give more context, as it displays sources of food and bus routes, as to show the connectivity of public transportation in the area.
</p>
<p>Route Information provided by <a href="https://wstransit.com/routes-and-schedules/">WSTA ,<a href="https://www.greensboro-nc.gov/departments/transportation/greensboro-transit-agency-public-transportation-division/routes-6948">GTA ,<a href="https://www.highpointnc.gov/576/Routes-Schedule">HPTS , and <a href="https://www.partnc.org/27/Routes-Schedules"> PART. </a></p>
<p>Food Source Information provided by <a href="https://mapf.maps.arcgis.com/apps/webappviewer/index.html?id=7492bd14581d4ac1a581f31ff506b7dc">The Forsyth County Department of Social Services</a> and Google Query.
<p>Map authored by Abe Krell</p>
</section>
<!-- above is writing included to give context for the web map -->
<div id="map"></div>
<script>
// establishing the map object
var mymap = L.map('map', {
center: [36.08168699308405, -80.1],
zoom: 11,
detectRetina: true // detect whether the screen is high resolution or not
});
// addition of the base map
L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png').addTo(mymap);
var food_spots = null;
var colors = chroma.scale('Set2').mode('lch').colors(3);
for (i = 0; i < 3; i++) {
$('head').append($("<style> .marker-color-" + (i + 1).toString() + " { color: " + colors[i] + "; font-size: 15px; text-shadow: 0 0 3px #ffffff;} </style>"));
}
// Get GeoJSON and put it on the map when it loads
food_spots = L.geoJson.ajax("assets/allpoints.geojson",{
onEachFeature: function (feature, layer) {
layer.bindPopup(feature.properties.Name);
},
pointToLayer: function(feature, latlng) { //not pop-up info, just to style the icon
var id = 0;
if (feature.properties.Kind == "Pantry") { id = 0; }
else if (feature.properties.Kind == "Grocery") { id = 1; }
else { id = 2;}
// All other property types from attribute table
return L.marker(latlng, {icon: L.divIcon({className: 'fas fa-shopping-basket marker-color-' + (id + 1).toString() })});
},
attribution: 'WSTA, GTA, HPTS, and PART Bus Routes | Route Coordinates and Lines generated by Google Maps | Base Map © CartoDB | Map Author: Abe Krell'
}).addTo(mymap);
function setColor(density) {
var id = 0;
if (density > 500000) { id = 4; }
else if (density > 250000 && density <= 500000) { id = 3; }
else if (density > 150000 && density <= 250000) { id = 2; }
else if (density > 50000 && density <= 150000) { id = 1; }
else { id = 0; }
return colors[id];
}
// ^^^^^^^^^I have tried remove the previous section of code, but doing that results in the map not loading
function style(feature) {
return {
fillColor: setColor(feature.properties.Name),
fillOpacity: 0.4,
weight: 3,
opacity: .5,
color: '#189BD8',
};
}
L.geoJson.ajax("assets/allroutes.geojson", {
style: style
}).addTo(mymap);
// Creation of Leaflet Control Object for Legend
var legend = L.control({position: 'topright'});
// Function that runs when legend is added to map
legend.onAdd = function () {
// Create Div Element and Populate it with HTML
var div = L.DomUtil.create('div', 'legend');
//this line creates a title for the legend
//this line provides the legend title for the colored symbols
div.innerHTML += '<b>Food Source<b><br />';
//the next 3 lines call the plane icon along with its proper color
//notice the names of the food source types listed within the <p> tags at the end of the lines
div.innerHTML += '<i class="fas fa-shopping-basket marker-color-1"></i><p>Food Pantry</p>';
div.innerHTML += '<i class="fas fa-shopping-basket marker-color-2"></i><p>Grocery Store</p>';
div.innerHTML += '<i class="fas fa-shopping-basket marker-color-3"></i><p>Farmers Market</p>';
// Return the Legend div containing the HTML content
return div;
};
// Adding a legend to map
legend.addTo(mymap);
// Add a scale bar to map to the bottom right
L.control.scale({position: 'bottomright'}).addTo(mymap);
L.control.mousePosition().addTo(map);
</script>
</body>
</html>