-
Notifications
You must be signed in to change notification settings - Fork 0
/
panoAvailable.html
102 lines (89 loc) · 2.81 KB
/
panoAvailable.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title></title>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#street-view {
height: 100%;
}
.infomsg {display:none;}
</style>
</head>
<body>
<div id="street-view"></div>
<script>
var lat_param = gup('lat');
var long_param = gup('long');
var width_param = gup('width');
var height_param = gup('height');
var heading_param = gup('heading');
var pitch_param = gup('pitch');
var zoom_param = gup('zoom');
var panorama;
function initialize() {
var posLatLon = { lat: filterFloat(lat_param), lng: filterFloat(long_param) };
var querypov = {pitch:0};
if (zoom_param != '') {
var z = filterInt(zoom_param);
if (!isNaN(z)) {
querypov.zoom = z;
}
}
if (heading_param != '') {
var h = filterFloat(heading_param);
if (!isNaN(h)) {
querypov.heading = h;
}
}
if (pitch_param != '') {
var p = filterFloat(pitch_param);
if (!isNaN(p)) {
querypov.pitch = p;
}
}
panorama = new google.maps.StreetViewPanorama(document.getElementById('street-view'),
{
position: posLatLon,
pov: querypov,
zoom: 1,
imageDateControl: true
});
var sv = new google.maps.StreetViewService();
sv.getPanoramaByLocation(posLatLon, 50, function(data) {
window.external.GetImageData(data.imageDate);
});
}
function filterInt(value) {
if (/^(\-|\+)?([0-9]+|Infinity)$/.test(value))
return Number(value);
return NaN;
}
function filterFloat(value) {
if (/^(\-|\+)?([0-9]+(\.[0-9]+)?|Infinity)$/
.test(value))
return Number(value);
return NaN;
}
function gup(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if (results == null)
return "";
else
return results[1];
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key={MY_KEY}&callback=initialize">
</script>
</body>
</html>