-
Notifications
You must be signed in to change notification settings - Fork 0
/
resize_marker_image.html
58 lines (51 loc) · 1.62 KB
/
resize_marker_image.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
#map {
position: absolute;
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<a href="https://onethinglab.wordpress.com/the-definitive-guide-to-google-maps-markers#marker-resize-image">How to resize marker image</a>
<div id="map"></div>
<script>
function add_marker(gmap, coordinates, icon) {
var marker = new google.maps.Marker({
position: coordinates,
map: gmap,
icon: icon
});
return marker;
}
function init_map() {
var places = {
'UA': { lat: 50.43333333, lng: 30.516667 },
'DE': { lat: 52.51666667, lng: 13.4 },
'GL': { lat: 64.18333333, lng: -51.75 },
'JP': { lat: 35.68333333, lng: 139.75 },
'MG': { lat: -18.91666667, lng: 47.516667 }
};
var gmap = new google.maps.Map(document.getElementById('map'),
{
zoom: 2,
center: { lat: -25.363, lng: 131.044 }
});
var size = 25;
for (var country in places) {
var icon = {
url: "images/pin.png",
scaledSize: new google.maps.Size(size, size),
};
add_marker(gmap, places[country], icon);
size += 10;
}
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?callback=init_map"></script>
</body>
</html>