-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcluster.html
More file actions
60 lines (52 loc) · 2.07 KB
/
cluster.html
File metadata and controls
60 lines (52 loc) · 2.07 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head></head>
<title>Tweet Clustering</title>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#cm-example { height: 100% }
</style>
<script type="text/javascript" src="http://tile.cloudmade.com/wml/latest/web-maps-lite.js"></script>
<script type = "text/javascript" src = "https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type = "text/javascript">
function initialize(){
var cloudmade = new CM.Tiles.CloudMade.Web({key: 'BC9A493B41014CAABB98F0471D759707', styleId:999});
map = new CM.Map('cm-example', cloudmade);
if(navigator.geolocation) {
browserSupportFlag = true;
navigator.geolocation.getCurrentPosition(function(position) {
initialLocation = new CM.LatLng(position.coords.latitude,position.coords.longitude);
map.setCenter(initialLocation, 10);
map.addControl(new CM.LargeMapControl());
map.addControl(new CM.ScaleControl());
map.addControl(new CM.OverviewMapControl());
bounds = map.getBounds();
sw = bounds.getSouthWest();
ne = bounds.getNorthEast();
}, function() {
});
}
CM.Event.addListener(map, 'moveend', function(latlng) {
bounds = map.getBounds();
sw = bounds.getSouthWest();
ne = bounds.getNorthEast();
getClusters();
});
}
function getClusters(){
$.get("/clusters", {swLat: sw.lat(), swLng: sw.lng(), neLat : ne.lat(), neLng: ne.lng(), zoom: map._zoom}, function(response){
console.log(response);
});
}
</script>
</head>
<body>
<div id="cm-example" style=""></div>
<script type="text/javascript">
$(document).ready(function(){
initialize();
});
</script>
</body>
</html>