This repository has been archived by the owner on Aug 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmap.html
83 lines (83 loc) · 2.54 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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?key=AIzaSyCiY15mZZyH28uRavik6TR0gQY-Hl6wKjw&sensor=false">
</script>
<script type="text/javascript">
var map;
var shadow;
var initialZoom = {
center: new google.maps.LatLng(0, 0),
zoom: 2
};
function initialize() {
var mapOptions = {mapTypeId: google.maps.MapTypeId.ROADMAP};
mapOptions.center = initialZoom.center;
mapOptions.zoom = initialZoom.zoom;
map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
shadow = new google.maps.Polygon({
paths: new Array,
strokeColor: "#000",
strokeOpacity: 0,
strokeWeight: 0,
fillColor: "#000",
fillOpacity: 0.25,
geodesic: true,
zIndex: -1,
map: map
});
};
function zoomToInitial() {
map.setOptions(initialZoom);
};
function onViewChanged(func) {
google.maps.event.addListener(map, 'zoom_changed', func);
google.maps.event.addListener(map, 'dragend', func);
}
function setShadowArrays(ary) {
r = new Array;
for(i = 0; i < ary.length; i += 1) {
r.push(new Array);
for(j = 0; j < ary[i].length; j += 1) {
r[i].push(new google.maps.LatLng(ary[i][j].lat, ary[i][j].lng));
};
};
shadow.setPaths(r);
};
function dropPin(lat, lng, icon, size, linkurl, zIndex) {
var marker = new google.maps.Marker({
map: map,
draggable: false,
animation: google.maps.Animation.DROP,
position: new google.maps.LatLng(lat, lng),
icon: {
url: icon,
scaledSize: new google.maps.Size(size, size),
anchor: new google.maps.Point(size/2, size/2),
},
zIndex: zIndex
});
google.maps.event.addListener(marker, 'click', function(){
window.open(linkurl);
});
return marker;
};
function removePin(marker) {
marker.setMap(null);
delete marker;
};
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"/>
</body>
</html>