-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.php
85 lines (71 loc) · 1.85 KB
/
example.php
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
<?php
$loc = (!empty($_GET['loc'])) ? $_GET['loc'] : 'seattle,wa';
$zoom = (!empty($_GET['z'])) ? (integer)$_GET['z'] : 6;
$intervals = (!empty($_GET['i'])) ? (integer)$_GET['i'] : 10;
$layers = (!empty($_GET['layers'])) ? $_GET['layers'] : 'flat,radar,admin';
$duration = (!empty($_GET['d'])) ? (double)$_GET['d'] : 4;
$from = (isset($_GET['from'])) ? (integer)$_GET['from'] : -2;
$to = (isset($_GET['to'])) ? (integer)$_GET['to'] : 0;
if ($zoom < 1) {
$zoom = 1;
}
if ($intervals < 5) {
$intervals = 5;
} else if ($intervals > 50) {
$intervals = 50;
}
$layers = explode(',', $layers);
?>
<!DOCTYPE html>
<html>
<head>
<title>AMP Visualizer Example</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="Demo project">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="./aerismaps-visualizer.css" rel="stylesheet" type="text/css">
<style type="text/css">
body {
font-family: "Helvetica","Arial",sans-serif;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript" src="./aerismaps-visualizer.js"></script>
<script type="text/javascript">
var now = new Date();
var map = new AerisMaps.Visualizer('#map', {
loc: '<?php echo $loc; ?>',
keys: {
id: '',
secret: ''
},
autoplay: true,
map: {
zoom: <?php echo $zoom; ?>,
layers: <?php echo json_encode($layers); ?>
},
animation: {
from: <?php echo $from; ?> * 3600,
to: <?php echo $to; ?> * 3600,
intervals: <?php echo $intervals; ?>,
duration: <?php echo $duration; ?>
},
overlays: {
title: 'Test Visualizer'
}
});
map.on('play', function(data) {
// console.log(data);
});
map.on('advance', function(data) {
// console.log(data.time);
});
map.on('load:progress', function(data) {
console.log('load progress: ' + data.loaded/data.total);
});
</script>
</body>
</html>