This repository has been archived by the owner on Dec 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.html
215 lines (195 loc) · 8.55 KB
/
map.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>IMD Map Explorer</title>
<link rel="stylesheet" type="text/css" href="stylesheets/map.css" />
<link type="text/css" href="javascripts/jquery-ui-1.8.16.custom/css/ui-darkness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false®ion=GB"></script>
<script type="text/javascript" src="javascripts/jquery-ui-1.8.16.custom/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="javascripts/jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="javascripts/raphael.js"></script>
<script type="text/javascript" src="javascripts/smoothcurves.js"></script>
<script type="text/javascript" src="javascripts/swirrl.js"></script>
<script type="text/javascript" src="javascripts/swirrl/array.js"></script>
<script type="text/javascript" src="javascripts/swirrl/view-helpers.js"></script>
<script type="text/javascript" src="javascripts/swirrl/score-domain-config.js"></script>
<script type="text/javascript" src="javascripts/swirrl/map-manager.js"></script>
<script type="text/javascript" src="javascripts/swirrl/sidebar-manager.js"></script>
<script type="text/javascript" src="javascripts/swirrl/postcode-manager.js"></script>
</head>
<body>
<script type="text/javascript">
var isIE = false;
var oldIE = false;
</script>
<!--[if lt IE 9]>
<script type="text/javascript">
oldIE = true;
</script>
<![endif]-->
<!--[if lt IE 8]>
<div style="font-size:15px; background: lemonChiffon; padding:10px;">
This site hasn't been tested on older versions of IE. Please use at least IE8 ...or a recent version of Firefox, Chrome or Safari!
</div>
<![endif]-->
<!--[if IE]>
<script type="text/javascript">
isIE = true;
</script>
<![endif]-->
<div id="container">
<div id="info">
<div id="search">
<form class="postcode_form" action="#">
Centre on postcode:<input type="text" id="postcode"/>
<input type="submit" value="go" />
</form>
</div>
<div id="lsoa">
<div style="margin-top:10px">Click or tap on an area in the map to see more information about it.</div>
</div>
<div id="credits">
<div>
<img src="images/question_mark.png"/>
<h4>What am I looking at?</h4>
</div>
<p style="clear:left">The map shows the <a href="http://en.wikipedia.org/wiki/ONS_coding_system" target="_blank">Lower Layer Super Output Areas</a> (LSOAs) in England, coloured to
indicate the level of deprivation in the area. Click on an area to see more information about it. You can use the drop down in the bottom-right of the map to switch between the different deprivation indicators.
</p><p>
Data taken from from the <a href="http://opendatacommunities.org/" target="_blank">2010 Indices of Multiple Deprivation</a>, hosted on <a href="http://publishmydata.com" target="_blank">PublishMyData</a>.</p>
<p>Made by <a href="http://swirrl.com" target="_blank">Swirrl</a> in 2011.</p>
</div>
</div>
<div id="map_canvas"></div>
<div id="zoom_warning" style="display:none"><div class="words">Zoom-level too wide. Please zoom in to see the LSOAs</div></div>
<div id="busy_notice" style="display:none"><img src="images/working.gif"/><div class="words">Working...</div></div>
<select id="domain">
<option value="score">Combined Score</option>
<option value="housing">Housing</option>
<option value="crime">Crime</option>
<option value="education">Education</option>
<option value="employment">Employment</option>
<option value="health">Health</option>
<option value="income">Income</option>
<option value="environment">Environment</option>
</select>
<div id="colour_key_container">
<div id="colour_key"></div>
</div>
<div style="display:none" id="templates">
<div class="lsoa_template">
<h3><a href="#" target="_blank">label</a></h3>
<span class="score_name"></span>: <a href="#" target="_blank" class="observation"><span class="score_value"></span></a><br/>
<div class="distro">
<div class="bg"></div>
<div class="graph"></div>
</div>
Min: <span class="min_score"></span>, Max: <span class="max_score"></span><br/>
<span style="font-size:10px"><em>Note: A higher score means the area is more deprived</em></span><br/>
<div>
<div id="splash" title="Deprivation Mapper">
<p>The map shows the Lower Layer Super Output Areas (LSOAs) in England, coloured to indicate the level of deprivation in the area.</p>
<p>Click on an area to see more information about it. You can change the deprivation indicator being shown by using the drop down in the bottom-right.</p>
<p>Start by searching for a postcode:</p>
<form class="postcode_form" action="#">
postcode: <input type="text" id="postcode"/>
<input type="submit" value="go" />
</form>
<p>...or just <a href="#" class="dialog_close">close this dialog</a> and drag/zoom the map.</p>
</div>
</div>
</div>
<script type="text/javascript">
(function(){
var mapManager
, idleListener = null
, startTime
, map = new google.maps.Map(document.getElementById("map_canvas"), {
zoom: 14,
center: new google.maps.LatLng(53.48, -2.245), // Manchester
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false
});
// draw the colour spectrum.
window.swirrl.viewHelpers.drawColourKey();
// make some manager objects
var mapManager = new swirrl.MapManager(map, "score"); // initialize with the overall score.
var sidebarManager = new swirrl.SidebarManager();
var postcodeManager = new swirrl.PostcodeManager();
// Handle events coming out of the Map Manager.
$(mapManager).bind('started', function() {
startTime = new Date();
if(idleListener) {
google.maps.event.removeListener(idleListener);
idleListener = null;
}
$("#busy_notice").show();
});
$(mapManager).bind('finished', function() {
window.swirrl.log('busy duration: ' + (new Date() - startTime) + ' ms');
$("#busy_notice").hide();
bindMapIdle();
});
$(mapManager).bind('zoomTooWide', function() {
if (!$("#zoom_warning").is(":visible")) {
$("#zoom_warning").show();
}
});
$(mapManager).bind('zoomOK', function() {
if ($("#zoom_warning").is(":visible")) {
$("#zoom_warning").hide();
}
});
$(mapManager).bind('polygonClick', function(e, lsoaNotation, data) {
sidebarManager.populate(lsoaNotation, data, $('#domain').val());
});
// handle events coming out of the postcodeManager
$(postcodeManager).bind('invalidPostcode', function(){
alert('please enter a valid postcode');
});
$(postcodeManager).bind('postcodeFound', function(e, lat, lng){
map.panTo(new google.maps.LatLng(lat, lng));
$("#splash").dialog('close');
mapManager.refresh();
});
// function to wire up the idleListener
var bindMapIdle = function() {
// if we don't already have an idle-listener, bind one up.
// (fires when the map bounds haven't changed for a bit)
if (!idleListener) {
idleListener = google.maps.event.addListener(map, 'idle', function(e) {
if (oldIE) {
// this fixes a problem in IE<8 where the idle listener just fires instantly!
setTimeout(
function() { mapManager.refresh(); },
500
);
}
else {
mapManager.refresh();
}
});
}
}
// bind the select box
$('#domain').change( function(e){
mapManager.changeScoreDomain($(this).val());
sidebarManager.clear();
});
// bind the postcode form
$(".postcode_form").submit(function(e){
e.preventDefault();
postcodeManager.lookup($(this).find("input[type=text]").val());
});
// Finally, start listening to Map-Idle events.
bindMapIdle();
$("#splash").dialog({ modal: true });
$("#splash a.dialog_close").click(function(e) {
e.preventDefault();
$("#splash").dialog('close');
})
})();
</script>
</body>
</html>