-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcovid.html
More file actions
68 lines (65 loc) · 2.54 KB
/
covid.html
File metadata and controls
68 lines (65 loc) · 2.54 KB
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
<!DOCTYPE html>
<html>
<head>
<title>MapQuest.js with basic map additions</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script src="https://api.mqcdn.com/sdk/mapquest-js/v1.2.0/mapquest.js"></script>
<link type="text/css" rel="stylesheet" href="https://api.mqcdn.com/sdk/mapquest-js/v1.2.0/mapquest.css"/>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.js"></script>
<script type="text/javascript">
var L, MQ, map;
function init() {
// create map with tile layer, center, and zoom
L.mapquest.key = "KEY";
map = L.mapquest.map("map", {
layers: L.mapquest.tileLayer("map"),
center: [40.731701,-73.993411],
zoom: 6
});
// add simple layer control
L.control.layers(
{
"Map": L.mapquest.tileLayer("map"),
"Sat": L.mapquest.tileLayer("satellite")
}
).addTo(map);
// data from https://github.com/CSSEGISandData/COVID-19
$.get( "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/03-15-2020.csv", function( data) {
data = data.split("\n");
data.shift(); // remove header row
data.forEach(function (record){
var cells = record.split(",");
if(record.indexOf("\"") > 0) {
// handle records with extra commas
}else{
var poptext =
(cells[0] ? (cells[0] + ", "):("")) +
cells[1] + "<br/>" +
"Confirmed: " + cells[3] + "<br/>" +
"Deaths: " + cells[4] + "<br/>" +
"Recovered: " + cells[5];
L.circleMarker(
[cells[6],cells[7]],
{
radius: (cells[3] < 1000 ? cells[3]/20 : 60),
color: "red",
fillColor: "red",
fillOpacity: 0.5
}
).bindPopup(poptext).addTo(map);
}
});
});
}
</script>
<style>
#map {
width: 800px;
height: 600px;
}
</style>
</head>
<body onload='init();'>
<div id="map"></div>
</body>
</html>