-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
62 lines (49 loc) · 1.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
<!DOCTYPE html>
<html>
<head>
<title>Homework 5 GES 771</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<style>
#map {
width: 900px;
height: 600px;
}
</style>
</head>
<body>
<div id='map'></div>
<script src="https://leenoah1.github.io/leaflet_ges/twitter_geojson.js" type="text/javascript"></script>
<script>
// Create the mapview
var map = L.map('map').setView([26.966311, -39.091339], 3);
// Add a tile layer to the mapview
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 3,
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
id: 'mapbox.light'
}).addTo(map);
// Add pop-up information (name & population) to the highlighted countries
function onEachFeature(feature, layer) {
var popupContent = "Country: " + feature.properties.name + "</br>" +
"Population: " + feature.properties.population;
if (feature.properties && feature.properties.popupContent) {
popupContent += feature.properties.popupContent;
}
layer.bindPopup(popupContent);
}
// Add the countries GeoJSON data to the map and color code by continent
L.geoJSON(countries, {
style: function(feature) {
switch (feature.properties.continent) {
case 'Americas': return {color: "#ff0000"};
case 'Europe': return {color: "#0000ff"};
}
},
onEachFeature: onEachFeature
}).addTo(map);