forked from volpino/openlayers-timeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
geojson.html
75 lines (69 loc) · 3.16 KB
/
geojson.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.13.custom.css" type="text/css" />
<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script src="lib/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="lib/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
<script src="http://openlayers.org/api/OpenLayers.js" type="text/javascript"></script>
<script src="lib/OpenLayers.Format.GeoJSONTimeline.js" type="text/javascript"></script>
<script src="timeline.js" type="text/javascript"></script>
<script type="text/javascript">
var map, timeline;
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: 'basic'}, {numZoomLevels: 5});
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0, 0), 2);
timeline = new OpenLayers.Timeline({map: map,
timeline: "#timeline",
date_key: "when",
format: OpenLayers.Format.GeoJSONTimeline});
var url = "http://toolserver.org/~sonet/api_geojson.php?article=OpenLayers&callback=?";
$.getJSON(url, function(data) {
$("#status").text("Data loaded");
timeline.initTimeline(data);
});
}
function toggleCumulative() {
if ($("#cumulative").attr("checked")) {
timeline.cumulative = true;
}
else {
timeline.cumulative = false;
}
timeline.update();
}
$(document).ready(function() {
init();
timeline.cumulative = true;
$("#cumulative").attr("checked", "checked");
});
</script>
</head>
<body>
<h1 id="title">OpenLayers Timeline GeoJSON Demo</h1>
<div id="container">
<p>
The source of the data is <a href="http://toolserver.org/~sonet/api_geojson.php">Toolserver</a>.
It represents anonymous edits on the OpenLayers Wikipedia page.
</p>
<p id="status">Loading...</p>
<div id="controls">
<input type="button" onclick="timeline.togglePlay();" value="Play/Pause" />
<input type="button" onclick="timeline.fasterAnimation();" value="Faster" />
<input type="button" onclick="timeline.slowerAnimation();" value="Slower" />
<label for="cumulative">Cumulative</label>
<input id="cumulative" type="checkbox" onChange="toggleCumulative();" />
</div>
<div id="timeline"></div>
<div id="map" class="smallmap"></div>
</div>
</body>
</html>