forked from elneilios/AzureSpeedTestMap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AzureSpeedTestMap.html
153 lines (131 loc) · 4.11 KB
/
AzureSpeedTestMap.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=false"></script>
<title>Azure Speed Test - Locations</title>
<style>
#map_canvas {
position:absolute;
width : 100%;
height: 100%;
top:0;
left:0;
}
#map_legend {
background: #fff;
border: 2px solid #000;
padding: 10px;
width: 200px;
}
#map_legend ul{
padding: 0;
margin: 0;
}
#map_legend li {
list-style: none;
clear:left;
}
#map_legend .legend-colour{
float:left;
margin-right: 5px;
height: 20px;
width: 20px;
}
</style>
</head>
<body>
<div id="map_canvas"></div>
<div id="map_legend">
<h4>Data Centres</h4>
<ul>
</ul>
<p><strong>Add your result to the map by trying <a href="http://azurespeedtest.azurewebsites.net/">the Windows Azure Speed Test</a> and then tweeting about it</strong></p>
<p>Created by <a href="https://www.twitter.com/elneilios/">@elneilios</a> at <a href="https://www.twitter.com/two10degrees/">@two10degrees</a>.</p>
<p><a href="https://github.com/elneilios/AzureSpeedTestMap">Fork</a> on GitHub</p>
<p><small>The latency times are indicative only, and do not represent the maxium performance achievable from Windows Azure. Use this website purely as a tool to gauge which Azure Data Center could be the best for your location.<br/>© Two10degrees 2013</small></p>
</div>
<script type="text/javascript">
var map;
var mapData = [];
var geocoder = new google.maps.Geocoder();
var colours = {"West Europe": "#7883c7",
"Southeast Asia": "#7ce051",
"East Asia": "#7148ce",
"North Central US": "#d2ce49",
"North Europe": "#cd58c7",
"South Central US": "#6dad4a",
"West US": "#57307d",
"East US": "#76dfa6",
"Japan East": "#c3487e",
"Japan West": "#46692c",
"Brazil South": "#d5493d",
"Central US": "#81c1d2",
"East US 2": "#d88941",
"Australia Southeast": "#432c49",
"Australia East": "#cfcc9b",
"West UK": "#7b3731",
"South UK": "#619780",
"Canada Central": "#cf9aae",
"Canada East": "#3f4940"}
$().ready(function(){
if(!map){
var map_canvas = document.getElementById('map_canvas');
var mapOptions = {
center: new google.maps.LatLng(0, 0),
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(map_canvas, mapOptions);
map.panToBounds(new google.maps.LatLngBounds(
new google.maps.LatLng(85, -180),
new google.maps.LatLng(-85, 180)));
var legend = $('#map_legend');
var legend_list = legend.find('ul');
for(var dc in colours){
if(dc != "Souteast Asia"){
var colour = colours[dc];
legend_list.append("<li><div class='legend-colour' style='background:"+colour+";'></div>" + dc + "</li>");
}
}
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('map_legend'));
}
run();
});
function run(){
$.ajax({
url: "/locations",
type: "GET",
success: function(data){
console.log(data);
mapData = data;
drawMarkers();
},
error: function(err){
console.log(err);
}
});
}
function drawMarkers(){
$.each(mapData, function(index, tweet){
if(tweet.geo && tweet.latency){
var colour = colours[tweet.dc];
var marker = new google.maps.Marker({
icon: {
path: google.maps.SymbolPath.CIRCLE,
strokeColor: colour,
fillColor: colour,
fillOpacity: 1,
scale: 5
},
position: new google.maps.LatLng(tweet.geo.lat, tweet.geo.lng),
title: tweet.text +'\nAddress: ' + tweet.addr + '\nData Center: ' + tweet.dc + '\nLatency: ' + tweet.latency + 'ms',
map: map
});
}
});
}
</script>
</body>
</html>