This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"coords": { | |
"lat": 40.750580, | |
"lng": -73.993584 | |
}, | |
"resolution": { | |
"height": "", | |
"width": "" | |
}, | |
"zoom": 11, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var properties = Object.values(location.properties); | |
var travelTime = properties[0].travel_time; | |
var travelTime = parseInt(travelTime); | |
listItem.innerHTML = location.id + ' - ETA: ' + Math.round(travelTime/60) + ' mins' ; | |
var properties = Object.values(location.properties); | |
var travelTime = properties[0].travel_time; | |
var travelTime = parseInt(travelTime); | |
listItem.innerHTML = location.id + ' - ETA: ' + Math.round(travelTime/60) + ' mins' ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
createLocationList(locationsInRange); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
createLocationList(locations); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var properties = Object.values(location.properties); | |
var travelTime = properties[0].travel_time; | |
var travelTime = parseInt(travelTime); | |
listItem.innerHTML = location.id + ' - ETA: ' + Math.round(travelTime/60) + ' mins' ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listItem.innerHTML = location.id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "Store 6", | |
"properties": [ | |
{ | |
"travel_time": 546, | |
"distance": 1739 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var item = locations.find(item => item.id === location.id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xhr.onreadystatechange = function () { | |
if (xhr.readyState === 4) { | |
console.log(xhr.status); | |
console.log(xhr.response) | |
var responseObject = xhr.response.results[0]; | |
var locationsInRange = responseObject.locations; | |
for (let location of locationsInRange) { | |
var item = locations.find(item => item.id === location.id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (let location of locations) | |
{ | |
var coords = Object.values(location.coords); | |
if(location.id.includes("Store")) | |
L.marker(coords, {icon: greenIcon}).addTo(mymap); | |
} |
NewerOlder