-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
169 lines (138 loc) · 6.47 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
<!DOCTYPE html>
<!-- This is a leaflet map created by Ragnar Heidar Thrastarson -->
<html>
<head>
<title>Icelandic Volcanoes | Learn to pronounce them BEFORE they erupt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.rawgit.com/lvoogdt/Leaflet.awesome-markers/2.0/develop/dist/leaflet.awesome-markers.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Droid+Sans|Roboto">
<a rel="me" href="https://mastodon.social/@RagnarHeidar">Mastodon</a>
<style>
/* style for map body */
html, body {
height: 100%;
width: 100%;
margin: 0;
}
/* style for title */
.map_title {
font-size: 26px;
font-family: 'Droid Sans', sans-serif;
position: absolute;
top:0;
left: 0;
right: 0;
height: 28px;
z-index: 10;
background-color: rgba(0,0,0,0.5);
color: #A03336;
padding: 6px;
margin: 0px;
text-align: center;
}
/* style for leaflet map */
#map {
position: absolute;
top:0;
left: 0;
right: 0;
bottom:0;
z-index: 1;
}
/* style for leaflet popup contents */
.leaflet-popup-content {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: #C8C7C7;
text-align: center;
line-height: 250%;
margin: 6px;
}
/* style for leaflet popup wrapper */
.leaflet-popup-content-wrapper {
background: #211D1E;
width: 320px;
}
/* style for markers */
.awesome-marker i {
font-size: 20px;
margin-top: 8px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/leaflet-extras/leaflet-providers/master/leaflet-providers.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/lvoogdt/Leaflet.awesome-markers/2.0/develop/dist/leaflet.awesome-markers.min.js" ></script>
</head>
<body>
<p class="map_title">Icelandic Volcanoes | Learn to pronounce them BEFORE they erupt</p>
<div id="map"></div>
<script type='text/javascript'>
var map = L.map('map', { zoomControl:false }).setView([64.99, -18.59], [7]);
//links and sources for attributes
signature ='<a href="http://lifeofamapmaker.com/" target="_blank"><img src="signature.png">'; //signature png and hyperlink for attributes
metoffice ='<a href="http://en.vedur.is/earthquakes-and-volcanism/volcanic-eruptions/" target="_blank">Icelandic Met Office</a>'; //Icelandic Met Office text and link for attributes
//add provider tile layer to map
L.tileLayer.provider("Esri.WorldImagery", {
maxZoom: 8, //set maximum zoom-in
minZoom: 2 //set maximum zoom-out
}).addTo(map);
//populate attribute line
map.attributionControl.addAttribution(metoffice); // add Icelandic Met Office to attribute line
map.attributionControl.addAttribution(signature); // add signature PNG to attribute line
//define marker icon for inactive volcanoes using Leaflet Awesome
var inactive_icon = L.AwesomeMarkers.icon({
icon: 'play-circle',
prefix: 'fa',
markerColor: 'darkred',
iconColor: '#000'
});
//define marker icon for active volcanoes using Leaflet Awesome
var active_icon = L.AwesomeMarkers.icon({
icon: 'play-circle',
prefix: 'fa',
markerColor: 'lightred',
iconColor: '#000'
});
//Get features from GeoJSON file
$.getJSON("IcelandicVolcanoes.json", function(data) {
//console.log("sucsess");
$.each(data.features, function(index, feature){
//console.log(index, feature);
var inactive = L.geoJson(data, {
filter: function(feature, layer) {
return feature.properties.active == "no";
},
pointToLayer: function(feature, latlng) {
return L.marker(latlng, { icon: inactive_icon, title: feature.properties.Name, riseOnHover: true })
},
onEachFeature: function(feature, layer) {
layer.bindPopup(feature.properties.spacename + "<audio id=sound controls=controls ><source src=audio/" + feature.properties.filename + " type=audio/mp3></audio>");
},
});
var active = L.geoJson(data, {
filter: function(feature, layer) {
return feature.properties.active == "yes";
},
pointToLayer: function(feature, latlng) {
return L.marker(latlng, { icon: active_icon, title: feature.properties.Name + " - Currently Active" })
},
onEachFeature: function(feature, layer) {
layer.bindPopup(feature.properties.spacename + "<audio id=sound controls=controls ><source src=audio/" + feature.properties.filename + " type=audio/mp3></audio>");
},
});
inactive.addTo(map); //add markes for inactive volcanoes
active.addTo(map); //add markes for active volcanoes
});
});
</script>
</body>
</html>