forked from sophiaxc/clustexer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_base.html
90 lines (83 loc) · 2.97 KB
/
_base.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple Polygon</title>
<style media="screen" type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map-canvas, #map_canvas {
height: 100%;
}
@media print {
html, body {
height: auto;
}
#map-canvas, #map_canvas {
height: 650px;
}
}
#panel {
position: absolute;
top: 5px;
left: 50%;
margin-left: -180px;
z-index: 5;
background-color: #fff;
padding: 5px;
border: 1px solid #999;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/maplabel/src/maplabel-compiled.js"></script>
<script>
function initialize() {
var mapOptions = {
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
map.fitBounds(new google.maps.LatLngBounds(
// SW corner, NE corner
new google.maps.LatLng({{map_bounds["SW"][0]}}, {{map_bounds["SW"][1]}}),
new google.maps.LatLng({{map_bounds["NE"][0]}}, {{map_bounds["NE"][1]}}))
);
{% for id, polygon_points in convex_hulls.iteritems() %}
var neighborhood_{{id}};
var neighborhood_{{id}}_points = [
{% for point in polygon_points %}
new google.maps.LatLng({{point[0]}}, {{point[1]}}),
{% endfor %}
];
neighborhood_{{id}} = new google.maps.Polygon({
paths: neighborhood_{{id}}_points,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 4,
fillColor: '#FF0000',
fillOpacity: 0.35 });
neighborhood_{{id}}.setMap(map);
console.log("{{polygon_centers[id]}}");
console.log("{{polygon_centers[id][0]}}");
var neighborhood_{{id}}_center = new google.maps.LatLng(
{{polygon_centers[id][0]}}, {{polygon_centers[id][1]}});
var neighborhood_label_{{id}} = new MapLabel({
text: '{{id}}',
position: neighborhood_{{id}}_center,
map: map,
fontSize: 35,
align: 'left' });
neighborhood_label_{{id}}.set('position', neighborhood_{{id}}_center);
{% endfor %}
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>