-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.html
77 lines (75 loc) · 2.24 KB
/
view.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
<!DOCTYPE html>
<html>
<head>
<style>
#map {
height: 300px;
width: 50%;
margin: auto;
}
#end{
position: absolute;
top: 65px;
right: 30px;
width: 450px;
height: 100px;
}
</style>
<link rel="stylesheet" href="https://bootswatch.com/flatly/bootstrap.min.css">
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<h1>Your Trip</h3>
<h4 id="st"></h2>
<h4 id="end"></h4>
<div id="map"></div>
<script>
var qs = (function(a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i)
{
var p=a[i].split('=', 2);
if (p.length == 1)
b[p[0]] = "";
else
b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
}
return b;
})(window.location.search.substr(1).split('&'));
function initMap() {
var l1,l2;
var query = qs['e'];
$.get("/getCoordinates?e="+query, function(data, status){
console.log(qs);
l1=parseFloat(data.st.lat);
l2=parseFloat(data.st.log);
l11=parseFloat(data.end.lat);
l12=parseFloat(data.end.log);
var uluru = {lat: l1, lng: l2 };
var uluru1 = {lat: l11, lng: l12 };
document.getElementById("st").innerHTML="Start <br>Latitude: "+data.st.lat +" Longitude: "+data.st.log+"<br> Time: "+data.st.time;
if(data.end.lat!='9999')
document.getElementById("end").innerHTML="End <br>Latitude: "+data.end.lat +" Longitude: "+data.end.log+"<br> Time: "+data.end.time;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: uluru
});
var marker = new google.maps.Marker({
position: uluru,
map: map,
label: 'S'
});
var marker1 = new google.maps.Marker({
position: uluru1,
map: map,
label: 'E'
});
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyActGUV22N-O3OuzlUut_kU3LH1b71UqnA&callback=initMap">
</script>
</body>
</html>