-
Notifications
You must be signed in to change notification settings - Fork 2
/
map.html
207 lines (144 loc) · 8.65 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
<script src="https://www.gstatic.com/firebasejs/4.10.1/firebase.js"></script>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Oldenburg" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<!-- Google Maps api -->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAikyBYHeJN3o85zIV21gusR0E9SXubJKs"></script>
<title>TAKE-A-HIKE</title>
</head>
<body class="map-body">
<div class="jumbotron jumbotron-fluid">
<h1 class="display-4 text-center">TAKE-A-HIKE</h1>
<a href="index.html" class="effect-underline header">HOME</a>
<a href="profile.html" class="effect-underline header">PROFILE</a>
<a href="favorites.html" class="effect-underline header">FAVORITES</a>
<a href="#" class="effect-underline header">LOG IN</a>
</div>
<div class="container">
<div id="map"></div>
<div class="row">
<div class="col">
<div id="trail-info"></div>
</div>
<div class="col">
<table class="table" id="trail-options">
<thead>
<tr>
<th scope="col">Select </th>
<th scope="col">Park</th>
<th scope="col">Distance</th>
<th scope="col">Hours</th>
</tr>
</thead>
<tbody>
<tr>
<td><button type="button" class="btn btn-light btnRow">Select</button></td>
<td>National</td>
<td>5 Miles</td>
<td>Sunrise-Sunset</td>
</tr>
<tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script type="text/javascript" charset="utf-8">
function initMap() {
var uluru = {lat: 38.9119, lng: -94.41362};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: uluru
});
var marker = new google.maps.Marker({
position: uluru,
map: map
});
};
/* require(["esri/map", "dojo/domReady!"], function(Map) {
var map = new Map("map", {
center: [-118, 34.5],
zoom: 8,
basemap: "topo"
});
*/
var myLat = 0;
var myLong = 0;
var queryURL = "";
x = navigator.geolocation;
x.getCurrentPosition(success, failure);
function success(position) {
myLat = parseFloat(position.coords.latitude);
myLong = parseFloat(position.coords.longitude);
//$('#lat').html("Latitude: " + myLat);
//$('#long').html("Longitude: " + myLong);
console.log(myLong);
console.log(myLat);
var apiKey = "200228428-1f5b2e55867344554f904d9273de0486";
queryURL = "https://www.hikingproject.com/data/get-trails?lat=" + myLat +
"&lon=" + myLong + "&maxDistance=100&key=" + apiKey;
console.log(queryURL);
$.ajax({
url: queryURL,
method: "GET"
})
.then(function (response) { // CREATE FUNCTION TO RUN AT THIS POINT
// Creating a div to hold the trail info
var trailDiv = $("<div class='trail'>");
var name = response.trails[0].name;
var pOne = $("<p>").text("Name: " + name);
trailDiv.append(pOne);
var location = response.trails[0].location;
var pTwo = $("<p>").text("Location: " + location);
trailDiv.append(pTwo);
var summary = response.trails[0].summary;
var pThree = $("<p>").text("Summary: " + summary);
trailDiv.append(pThree);
var imgURL = response.trails[0].imgSmallMed;
var image = $("<img>").attr("src", imgURL);
trailDiv.append(image);
// Putting the entire movie above the previous movies
$("#trail-info").prepend(trailDiv);
console.log(response);
var title = response.trails;
console.log("Trail Name: " + response.trails[1].name);
console.log("About: " + response.trails[1].summary);
console.log("Location: " + response.trails[1].location);
console.log("-----------------------------------------");
console.log("Trail Name: " + response.trails[2].name);
console.log("About: " + response.trails[2].summary);
console.log("Location: " + response.trails[2].location);
console.log("-----------------------------------------");
console.log("Trail Name: " + response.trails[3].name);
console.log("About: " + response.trails[3].summary);
console.log("Location: " + response.trails[3].location);
console.log("-----------------------------------------");
});
}
function failure() {
$('#fail').html("<p>It didn't work.</p>");
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAikyBYHeJN3o85zIV21gusR0E9SXubJKs&callback=initMap">
</script>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="assets/javascript/main.js"></script>
</body>
</html>