-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpanoramio.html
63 lines (57 loc) · 1.8 KB
/
panoramio.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
<!DOCTYPE html>
<html>
<head>
<title>Panoramio Layer</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<link href="default.css" rel="stylesheet">
<style>
#photo-panel {
background: #fff;
padding: 5px;
overflow-y: auto;
overflow-x: hidden;
width: 300px;
max-height: 300px;
font-size: 14px;
font-family: Arial;
border: 1px solid #ccc;
box-shadow: -2px 2px 2px rgba(33, 33, 33, 0.4);
display: none;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=panoramio"></script>
<script>
function initialize() {
var mapOptions = {
zoom: 16,
center: new google.maps.LatLng(47.651743, -122.349243),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var panoramioLayer = new google.maps.panoramio.PanoramioLayer();
panoramioLayer.setMap(map);
var photoPanel = document.getElementById('photo-panel');
map.controls[google.maps.ControlPosition.RIGHT_TOP].push(photoPanel);
google.maps.event.addListener(panoramioLayer, 'click', function(photo) {
var li = document.createElement('li');
var link = document.createElement('a');
link.innerHTML = photo.featureDetails.title + ': ' +
photo.featureDetails.author;
link.setAttribute('href', photo.featureDetails.url);
li.appendChild(link);
photoPanel.appendChild(li);
photoPanel.style.display = 'block';
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<ul id="photo-panel">
<li><strong>Photos clicked</strong></li>
</ul>
<div id="map-canvas"></div>
</body>
</html>