forked from aogdp/mural-story-map
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
281 lines (246 loc) · 8.61 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
<!DOCTYPE html>
<html>
<head>
<title>AOGDP Mural Story Map</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<!--Font Awesome CDN and Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<!--leaflet 1.0 RC-1 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/leaflet/1.0.0-rc.1/leaflet.css" />
<script src="https://cdn.jsdelivr.net/leaflet/1.0.0-rc.1/leaflet.js"></script>
<!-- Leaflet Omnivore Plugin GeoJson KML Etc -->
<script src='https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-omnivore/v0.3.1/leaflet-omnivore.min.js'></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-ajax/2.0.0/leaflet.ajax.min.js"></script>
<!--marker cluster for 1.0-->
<link href='//www.ovrdc.org/apps/assets/cssjs/marker-cluster/MarkerCluster.css' rel='stylesheet' />
<link href='//www.ovrdc.org/apps/assets/cssjs/marker-cluster/MarkerCluster.Default.css' rel='stylesheet' />
<script src='//www.ovrdc.org/apps/assets/cssjs/marker-cluster/leaflet.markercluster.js'></script>
<!--jquery scroller plugin-->
<link href="thumbnail-scroller/jquery.mThumbnailScroller.min.css" rel="stylesheet" />
<script src="thumbnail-scroller/scroller.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.fullscreen/1.4.2/Control.FullScreen.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.fullscreen/1.4.2/Control.FullScreen.min.js"></script>
<style>
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
.leaflet-popup-content img {
max-width: 100%;
}
#thumbs {
overflow: auto;
width: 800px;
height: auto;
z-index: 700;
}
.content {
overflow: auto;
position: relative;
padding: 10px;
background-color:rgba(51, 51, 51, 0.21);;
margin: 20px;
width: 50%;
height: auto;
float: left;
}
.content li {
margin: 4px;
overflow: hidden;
}
.content li a {
display: inline-block;
border: 7px solid rgba(255, 255, 255, .1);
}
.mTSButton {
background-color: #c2beb2;
}
#content-6 .mTSButton {
background-color: rgba(0, 0, 0, .7);
-moz-border-radius: 48px;
-webkit-border-radius: 48px;
border-radius: 48px;
}
#content-6 .mTSButtonLeft {
left: 5px;
width: 48px;
height: 48px;
}
#content-6 .mTSButtonRight {
right: 5px;
width: 48px;
height: 48px;
}
#content-6 {
/*background-color: black;*/
position: absolute;
bottom: 0;
left: 0;
width: 100%;
margin: 0;
height: 200px;
z-index: 1000;
}
.leaflet-popup-content {
height: auto!important;
}
.leaflet-popup-scrolled {
border: none;
}
#loader {
position: absolute;
top: 40%;
left: 48%;
margin: 0 auto;
z-index: 9999;
width: 100px;
background: white;
}
</style>
</head>
<body>
<!--div id="loader"><img src="images/loader.gif" /></div-->
<div id="map"></div>
<div id="content-6" class="content">
<ul id="thumbsList">
</ul>
</div>
<script>
var map = new L.Map('map', {
zoom: 15,
fullscreenControl: true,
center: [39.7, -82.8],
});
var OpenStreetMap_BlackAndWhite = L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
});
var cdblight = L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_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',
minZoom: 0,
maxZoom: 22,
maxNativeZoom: 18,
}).addTo(map);
var esrigray = L.tileLayer('//server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles © Esri — Esri, DeLorme, NAVTEQ',
maxNativeZoom: 16,
maxZoom: 19,
});
//Define style & Load Appalachian Counties outline
var appalachia = L.geoJson(null, {
style: {
color: '#f00',
weight: 3,
opacity: 1,
fillOpacity: 0.1,
interactive: false,
dashArray: "5, 8",
}
}).addTo(map);
var appalachiaData = omnivore.geojson("Ohio_Appalachian_Region.geojson",null, appalachia);
//Load with AJAX Plugin
/*var appalachiaData2 = new L.geoJSON.ajax("Ohio_Appalachian_Region.geojson", {
style: {
color: "purple",
}
})
.addTo(map);
*/
var x = 0;
//GeoJson layer to hold the csv data
var muralLayer = new L.geoJson(null, {
pointToLayer: function(feature, latlng) {
return L.circleMarker(latlng, {
radius: 8,
fillColor: "#75EDFE",
color: "#000",
weight: 1,
opacity: 1,
fillOpacity: 0.8
});
},
onEachFeature: function(feature, layer) {
//feature.properties && feature.properties.Title && feature.properties.Location
if (feature.properties.filename) {
feature.properties.id = x;
x = x+1;
console.log('getting info');
var file = feature.properties.filename;
var filelink = file.replace(/\s/g,'_');
var url = "images/compressed/" + filelink;
//console.log(url);
var layerx = layer.getLatLng().Latitude;
var layery = layer.getLatLng().Longitude;
var name = feature.properties.Name;
var id = feature.properties.id;
console.log(id);
layer.bindPopup('<img src="' + url + '" style="width:300px;padding:10px 0;"><br/><h4>' + name + '</h4>' + feature.properties.Message + '<br /><span id = "directions"><a href="https://www.google.com/maps/dir//?saddr=My+Location' + '&daddr=' + layerx + ',' + layery + '" target="_blank">Directions</a></span></a></li>',
{
minWidth: 310,
maxHeight: 280,
});
//var id = feature.properties.ID;
var title = feature.properties.Name;
//console.log(id);
$("#content-6").mThumbnailScroller({
type: "click-25",
/*change to "y" for vertical scroller*/
});
$("#mTS_1_container").append('<li class="mTSThumbContainer"><a id ="' + id + '" class="mural-img" href="' + '#' + '"><img src="' + url + '" title="' + name + '" height=166px class="mTSThumb" />');
}
}
});
var muralCluster = new L.markerClusterGroup({
disableClusteringAtZoom: 14,
zoomToBoundsOnClick: true,
spiderfyOnMaxZoom: false,
}).addTo(map);
//CSV LOAD- Features via omnivore and add them to the mural layer
var muraldata = omnivore.csv('murals.csv', null, muralLayer);
//Wait for the data to be loaded before doing a few other things.
muraldata.on('ready', function() {
setTimeout(function() {
$("#loader").fadeOut();
},2000);
console.log(muraldata);
map.fitBounds(muralLayer.getBounds(), {maxZoom: 8});
muralCluster.addLayer(muralLayer);
muralCluster.on('clusterclick', function(e) {
console.log(e);
map.flyTo(e.layer.getLatLng(), 15, {duration: 2})
});
console.log('mural data ready');
console.log(muralLayer);
//assign a click event to the mural images
$(".mural-img").click(function() {
map.closePopup();
var clickID = "";
clickID = $(this).prop('id');
console.log(clickID);
muralLayer.eachLayer(function(layer) {
if ((layer.feature.properties.id) == clickID) {
map.flyTo(layer.getLatLng(), 15);
var click = 1;
map.on('moveend', function() {
if (click === 1) {
layer.openPopup();
}
});
layer.on('popupopen', function() {
click = 2
});
}
});
click = 2;
});
});
</script>
</body>
</html>