Repository navigation
Expand file tree
/
Copy pathmap_google_example_simple2v2.html
More file actions
117 lines (107 loc) · 3.42 KB
/
Copy pathmap_google_example_simple2v2.html
File metadata and controls
117 lines (107 loc) · 3.42 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
<!DOCTYPE html>
<html>
<head>
<title>V2 tow markers with labels</title>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height:100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
// Multiple Markers
var locations = [
['Zara Vouliagmenis', 37.939771, 23.740331, 10],
['Zara Ermou', 37.975759, 23.732745, 9],
['Zara Ermou II', 37.976261, 23.729303, 8],
['Zara Stadiou', 37.979600, 23.732117, 7],
['Zara Stadiou II', 37.983293, 23.729071, 6],
['Zara 28 Oktovriou', 37.999365, 23.733575, 5],
['Zara Patision', 37.999770, 23.733086, 4],
['Zara Kallitheas', 37.957807, 23.704887, 3],
['Zara Nea Smyrni', 37.946859, 23.711197, 2],
['Zara Peiraia', 37.941151, 23.647791, 1]
];
// Create map
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
center: new google.maps.LatLng(37.975753, 23.733872),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
// Change default markers to blue ones.
var image = {
url: 'https://cdn2.iconfinder.com/data/icons/snipicons/500/map-marker-256.png',
scaledSize: new google.maps.Size(30, 32)
};
var infowindow = new google.maps.InfoWindow();
var marker, i;
// Loop throught each location
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
icon: image
});
// Add the info window
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
var cityCircle = new google.maps.Circle({
strokeColor: '#6495ED',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#6495ED',
fillOpacity: 0.35,
map: map,
center: {
lat: 37.975753,
lng: 23.733872
},
radius: 100
});
var triangleCoords = [
{lat: 38.032348, lng: 23.729421},
{lat: 37.927021, lng: 23.618698},
{lat: 37.926712, lng: 23.833461}
];
var emptyTriangle = new google.maps.Polygon({
paths: triangleCoords,
strokeColor: '#6495ED',
strokeOpacity: 0.8,
strokeWeight: 3,
fillColor: 'transparent',
fillOpacity: 0.5
});
emptyTriangle.setMap(map);
var storePath = [
{lat:37.939771, lng:23.740331},
{lat:37.946859, lng:23.711197}
]
var storeConnection = new google.maps.Polyline({
path: storePath,
geodesic: true,
strokeColor: '#7FFF00',
strokeOpacity: 1.0,
strokeWeight: 2
});
storeConnection.setMap(map);
}
</script>
</body>
</html>