-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflight.html
156 lines (150 loc) · 4.83 KB
/
flight.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Visualflee - refugee movement</title>
<script src="https://unpkg.com/leaflet@1.0.1/dist/leaflet.js"></script>
<script src="leaflet.timeline.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.1/dist/leaflet.css" />
<style>
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
html, body{
margin: 0;
padding: 0;
font-family: "Open Sans", sans-serif;
}
#info{
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 20vw;
padding: 1em;
}
#map{
position: fixed;
top: 0;
left: 20vw;
bottom: 0;
right: 0;
}
.leaflet-bottom.leaflet-left{
width: 100%;
}
.leaflet-control-container .leaflet-timeline-controls{
box-sizing: border-box;
width: 100%;
margin: 0;
margin-bottom: 15px;
}
.key-colour {
width: 20px;
height: 10px;
border: 1px solid black;
display: inline-block;
margin-right: 10px;
vertical-align: middle;
}
.key-size {
display: inline-block;
margin-right: 10px;
border: 1px solid black;
vertical-align: middle;
}
.key-size-row {
padding: 5px;
}
</style>
</head>
<body>
<div id="info">
<h1>Predicting forced displacement movements</h1>
<h3>Location types:</h3>
<div>
<div class="key-colour" style="background-color: rgb(246, 29, 49)"></div>Conflict Zone
</div>
<div>
<div class="key-colour" style="background-color: rgb(8, 94, 29)"></div>Camp
</div>
<div>
<div class="key-colour" style="background-color: rgb(250, 246, 91)"></div>Interconnecting Town
</div>
<div>
<div class="key-colour" style="background-color: rgb(2, 250, 47)"></div>Forwarding Hub
</div>
<h3>Population size:</h3>
<div class="key-size-row">
<div class="key-size" style="width: 4px; height: 4px; border-radius: 2px;"></div>
100 people
</div>
<div class="key-size-row">
<div class="key-size" style="width: 13px; height: 13px; border-radius: 7px;"></div>
1000 people
</div>
<div class="key-size-row">
<div class="key-size" style="width: 30px; height: 30px; border-radius: 14px;"></div>
10000 people
</div>
</div>
<div id="map"></div>
<script>
var status_colors = {
'city': 'rgb(250, 246, 91)',
'conflict': 'rgb(246, 29, 49)',
'camp': 'rgb(8, 94, 29)',
'forwarding_hub': 'rgb(2, 250, 47)',
}
// Set up the Leaflet js map, with map tiles from OpenStreetMap.
// L is the Leaflet API object
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib = '© <a href="http://openstreetmap.org/copyright">' +
'OpenStreetMap</a> contributors';
var osm = L.tileLayer(osmUrl, {
maxZoom: 18,
attribution: osmAttrib,
noWrap: true
});
var map = L.map('map', {
layers: [osm],
center: new L.LatLng(-3.0, 29.4),
zoom: 8,
maxBounds: [[90,-180], [-90, 180]]
});
// jpcallback is called once the geojsonp file below loads
function jpcallback(data){
// The following code sets up the timeline and the points that respond
// to it. The points don't really change size - we have a separate
// point for each day at each location, and as the timeline runs, it
// shows the points for one day, then hides them as it shows the next
// day.
var getInterval = function(datapt) {
return {
start: new Date(datapt.properties.start).getTime(),
end: new Date(datapt.properties.end).getTime()
};
};
var timelineControl = L.timelineSliderControl({
formatOutput: function(date) {
return new Date(date).toUTCString();
}
});
var timeline = L.timeline(data, {
getInterval: getInterval,
pointToLayer: function(data, latlng){
return L.circleMarker(latlng, {
radius: (0.2 * Math.sqrt(data.properties.population)),
color: "#000",
fillColor: status_colors[data.properties.loctype || 'city'],
fillOpacity: 0.5,
}).bindPopup(data.properties.name);
}
});
timelineControl.addTo(map);
timelineControl.addTimelines(timeline);
timeline.addTo(map);
}
</script>
<!-- This loads the data to make the visualisation -->
<script src="all_camps.jsonp"></script>
</body>
</html>