-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
110 lines (92 loc) · 2.73 KB
/
index.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>City Watch</title>
<meta name="description" content="City Watch">
<meta name="author" content="geniuses">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
width: 50%;
}
/* Optional: Makes the sample page fill the window. */
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<link rel="stylesheet" href="index.css">
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
var seattleCenter = {
lng: -122.34568058,
lat: 47.6233863
}
map = new google.maps.Map(document.getElementById('map'), {
center: {
lat: seattleCenter.lat,
lng: seattleCenter.lng},
zoom: 13
});
map.data.loadGeoJson('testdata/testdata.json');
map.data.setStyle(function(feature) {
var type = feature.getProperty('type');
var subType = feature.getProperty('subType');
var color;
var geo = feature.getGeometry();
switch(type) {
case "CRIME":
color = "red";
feature.circle = new google.maps.Circle({
map: map,
center: geo.b[0],
radius: 50,
fillColor: '#FF0000',
fillOpacity: 0.4,
strokeColor: '#FF0000',
strokeOpacity: 0.4,
strokeWeight: 1
});
break;
case "MARIANNE":
color = "blue";
feature.circle = new google.maps.Circle({
map: map,
center: geo.b[0],
radius: 50,
fillColor: '#FF0000',
fillOpacity: 0.4,
strokeColor: '#FF0000',
strokeOpacity: 0.4,
strokeWeight: 1
});
break;
default:
color = "black";
break;
}
return {
fillColor: color,
strokeWeight: 1
};
});
}
</script>
<script src="index.js"></script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBCaM_6h03Fs34GV7c8jonME5B3dAk3AYY&callback=initMap">
</script>
</body>
</html>