Hi All, Can anyone help with getting the distance and directions between two points. I have manged to put the code like this
getDirections=(e)=>
{
const {google} = this.props;
const directionsService = new google.maps.DirectionsService();
const directionsDisplay = new google.maps.DirectionsRenderer();
var request = {
origin: this.state.origin,
destination: this.state.destination,
travelMode: 'DRIVING'
};
directionsService.route(request, function(result, status) {
console.log(result)
if (status === 'OK') {
directionsDisplay.setDirections(result);
}
else
{
window.alert('Directions request failed due to ' + status);
}
});
}
But this is not showing anything on the map, please help.
Can you put together a gist? I can try to help debug with more context...
Hi Guys,
sorry to re-open an old conversation but does anyone have something for directions that works?
Thanks