+ Start a Discussion
BJMBJM 

Display route map on goolgemaps from current location

Hi,
I have displayed all the contacts and Leads on google maps from the cuurent location with 10km distance
here i have displayed an infowindow including button named Getdirection for each marker(Contacts and Leads),
here i need to display the route map from current location to particular selected marker



Thanks & Regards
Gaurav KheterpalGaurav Kheterpal
You need to use the Directions Service to show the route map. For example
 
navigator.geolocation.getCurrentPosition(function (position) {

    var latitude = position.coords.latitude;
    var longitude = position.coords.longitude;
    var coords = new google.maps.LatLng(latitude, longitude);
 
    var request = {
        origin: coords,
        destination: "{!Account.BillingStreet},{!Account.BillingCity},{!Account.BillingState}",
        travelMode: google.maps.DirectionsTravelMode.DRIVING
    }
If my answer helps resolve your query, please mark it as the 'Best Answer' to benefit others and improve the overall quality of Discussion Forums.