Notify the user, when the user goes in wrong direction (Google Directions API)
If you are using Google's Direction API, it easy fairly easy to determine whether a user is following the route or not.
If the user fails to follow the path, the user can be notified and given the right instructions to remain on the path. Most of the time, the user gets a new route, i.e. the route changes.
It can be implemented as below.
If the user fails to follow the path, the user can be notified and given the right instructions to remain on the path. Most of the time, the user gets a new route, i.e. the route changes.
It can be implemented as below.
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 directionsService = new google.maps.DirectionsService; //defining the direction service and renderer | |
var directionsRenderer = new google.maps.DirectionsRenderer({ | |
draggable: true, | |
map: map, | |
panel: document.getElementById('right-panel') | |
}); | |
//implement the directions_changed listener and the notify the user... | |
directionsRenderer.addListener('directions_changed', function() { | |
//notify the user | |
}); |