Repository navigation
Expand file tree
/
Copy pathexample.html
More file actions
242 lines (215 loc) · 12 KB
/
Copy pathexample.html
File metadata and controls
242 lines (215 loc) · 12 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
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Cartisan Map Example</title>
<style>
#map {
height: 90vh;
width: 100%;
position: relative;
}
/* example pop-up style */
.popup
{
line-height: 2;
color: #555;
padding: 0 5px;
}
h2.popup-project-title
{
text-align: center;
margin-bottom: 4px;
}
.popup-info-col
{
width: 100%;
max-width: 25px;
display: inline-block;
}
.popup-info-enddate
{
width: 25px;
display: inline-block;
margin-left: 25px;
}
button.view-project-button
{
border: 1px solid #ccc;
padding: 5px 10px;
cursor: pointer;
text-align: center;
display: block;
margin: 0 auto;
background-color: transparent;
border-radius: 3px;
margin-top: 10px;
color: #555;
width: auto;
height: auto;
}
button {
background-color: #999;
width: 180px;
height: 40px;
z-index: 2000;
color: #fff;
cursor: pointer;
margin: 10px;
border: none;
}
.buttons {
display: block;
margin: 0 auto;
width: 100%;
max-width: 1020px;
}
</style>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
</head>
<body>
<!-- required map div -->
<div id="map"></div>
<div class="buttons">
<button onclick="cartisanMap.clearMarkers()">clear markers</button>
<button onclick="cartisanMap.renderMarkers(allMarkers)">render all markers</button>
<button onclick="cartisanMap.renderMarkers(exampleMarkers)">render example markers</button>
<button onclick="cartisanMap.openPopup('1')">open Marker 1</button>
<button onclick="cartisanMap.openPopup('3')">open Marker 3</button>
</div>
<!-- load the deps -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBXyl73GCR9UGBHN11MzABQZ78NxlVwwuA"> // your api key here
</script>
<script src="../src/markerclusterer.js">
</script>
<script src="../src/cartisanmap.js">
</script>
<script>
// png style
var icon = {
url: 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png',
// This marker is 20 pixels wide by 32 pixels high.
size: new google.maps.Size(20, 32),
// The origin for this image is (0, 0).
origin: new google.maps.Point(0, 0),
// The anchor for this image is the base of the flagpole at (0, 32).
anchor: new google.maps.Point(0, 32)
};
// svg style
var icon2 = {
path: 'M -1,0 A 1,1 0 0 0 -3,0 1,1 0 0 0 -1,0M 1,0 A 1,1 0 0 0 3,0 1,1 0 0 0 1,0M -3,3 Q 0,5 3,3',
strokeColor: '#00F',
rotation: 45,
scale: 5
};
// png style
var icon3 = {
url: 'marker.png',
// This marker is 20 pixels wide by 32 pixels high.
size: new google.maps.Size(30, 30),
// The origin for this image is (0, 0).
origin: new google.maps.Point(0, 0),
// The anchor for this image is the base of the flagpole at (0, 32).
anchor: new google.maps.Point(0, 32)
};
// example marker objects
var exampleMarkers = [{
"markerID":"1", // his id is used to zoom in on marker with openPopup(markerID)
"icon":icon, // absolute url or relative to document
"iconOpen":icon2,
"iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Down-sized coherent open system</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Telecommunications Equipment<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>4/26/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>1/3/2035<br /><button class='view-project-button'>View project</button></div>",
"coordinates": [40.04130429,45.62966304]}, // lat, lng
{
"markerID":"2",
"icon":icon,"iconOpen":icon2, "iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Proactive bi-directional circuit</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>n/a<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>4/8/2016<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>8/17/2027<br /><button class='view-project-button'>View project</button></div>","coordinates": [40.3159495,44.43132324]},
{"markerID":"3","icon":icon,"iconOpen":icon2, "iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Cloned homogeneous matrix</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Electric Utilities: Central<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>1/18/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>10/23/2034<br /><button class='view-project-button'>View project</button></div>","coordinates": [40.42335041,44.70061002]},
{"markerID":"4","icon":icon,"iconOpen":icon2, "iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Cloned homogeneous matrix</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Electric Utilities: Central<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>1/18/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>10/23/2034<br /><button class='view-project-button'>View project</button></div>","coordinates": [40.42335041,44.70061002]},
{"markerID":"5","icon":icon,"iconOpen":icon2, "iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Cloned homogeneous matrix</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Electric Utilities: Central<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>1/18/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>10/23/2034<br /><button class='view-project-button'>View project</button></div>","coordinates": [40.42335041,44.70061002]},
{"markerID":"6","icon":icon,"iconOpen":icon2, "iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Cloned homogeneous matrix</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Electric Utilities: Central<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>1/18/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>10/23/2034<br /><button class='view-project-button'>View project</button></div>","coordinates": [40.42335041,44.70061002]},
{
"markerID":"7", // his id is used to zoom in on marker with openPopup(markerID)
"icon":icon, // absolute url or relative to document
"iconOpen":icon2,
"iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Down-sized coherent open system</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Telecommunications Equipment<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>4/26/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>1/3/2035<br /><button class='view-project-button'>View project</button></div>",
"coordinates": [40.04130429,45.62966304]}, // lat, lng
{
"markerID":"8", // his id is used to zoom in on marker with openPopup(markerID)
"icon":icon, // absolute url or relative to document
"iconOpen":icon2,
"iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Down-sized coherent open system</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Telecommunications Equipment<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>4/26/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>1/3/2035<br /><button class='view-project-button'>View project</button></div>",
"coordinates": [40.04130429,45.62966304]}, // lat, lng
{
"markerID":"9", // his id is used to zoom in on marker with openPopup(markerID)
"icon":icon, // absolute url or relative to document
"iconOpen":icon2,
"iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Down-sized coherent open system</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Telecommunications Equipment<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>4/26/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>1/3/2035<br /><button class='view-project-button'>View project</button></div>",
"coordinates": [40.04130429,45.62966304]}, // lat, lng
{
"markerID":"10", // his id is used to zoom in on marker with openPopup(markerID)
"icon":icon, // absolute url or relative to document
"iconOpen":icon2,
"iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Down-sized coherent open system</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Telecommunications Equipment<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>4/26/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>1/3/2035<br /><button class='view-project-button'>View project</button></div>",
"coordinates": [40.04130429,45.62966304]}, // lat, lng
{
"markerID":"11", // his id is used to zoom in on marker with openPopup(markerID)
"icon":icon, // absolute url or relative to document
"iconOpen":icon2,
"iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Down-sized coherent open system</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Telecommunications Equipment<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>4/26/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>1/3/2035<br /><button class='view-project-button'>View project</button></div>",
"coordinates": [40.04130429,45.62966304]}, // lat, lng
{
"markerID":"12", // his id is used to zoom in on marker with openPopup(markerID)
"icon":icon, // absolute url or relative to document
"iconOpen":icon2,
"iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Down-sized coherent open system</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Telecommunications Equipment<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>4/26/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>1/3/2035<br /><button class='view-project-button'>View project</button></div>",
"coordinates": [40.04130429,45.62966304]},
{
"markerID":"13", // his id is used to zoom in on marker with openPopup(markerID)
"icon":icon, // absolute url or relative to document
"iconOpen":icon2,
"iconHover":icon3,
"popupHTML":"<div class='popup'><h2 class='popup-project-title'>Down-sized coherent open system</h2><span class='popup-info-col'><i class='fa fa-industry'></i></span>Telecommunications Equipment<br /><span class='popup-info-col'><i class='fa fa-clock-o'></i> </span>4/26/2010<span class='popup-info-enddate'><i class='fa fa-flag'></i></span>1/3/2035<br /><button class='view-project-button'>View project</button></div>",
"coordinates": [40.04130429,45.62966304]}
];
var cartisanMapOptions = {
mapID : "map", // the html id of map div
infoWindowWidth: 500, // width of the pop-ups in px (int)
clusterIcons: [ // refer to https://googlemaps.github.io/js-marker-clusterer/docs/reference.html for supported styles
{
url:"cluster1.png", // smallest icon, absolute url, or relative to document (string)
width: 40,
height: 40,
},{
url:"cluster2.png",
width: 50, // width = height, in pixels (int)
height: 50,
},{
url:"cluster3.png",
width: 65,
height: 65
},{
url:"cluster4.png", // largest icon
width: 80,
height: 80
}
]
};
var cartisanMap = new CartisanMap(cartisanMapOptions);
</script>
<!-- all markers -->
<script src="example_random_markers.js">
</script>
</body>
</html>