I have a two points:
1) start point
2) destination point
To draw the path between the two points im doing so with the function shown below called calculateAndDisplayRoute():
What i want to do is track the user live location marker to be shown on the drawn path and also how can i test user live location when im using localhost.
Any help is appreciated.
What I have tried:
function calculateAndDisplayRoute(directionsService, directionsDisplay) {
var dest;
if ($("#pac-input").val() != "") {
dest = $("#pac-input").val();
} else { dest = GlobalstartPoint }
directionsService.route({
origin: dest,
destination: document.getElementById('endPoint').value,
optimizeWaypoints: true,
travelMode: 'DRIVING'
}, function (response, status) {
console.log(response)
console.log(status)
if (status === 'OK') {
directionsDisplay.setDirections(response);
//var route = response.routes[0];
} else {
window.alert('Directions request failed due to ' + status);
}
});
}