Calculating Map Driving Distance?

I have a salesforce geolocation field that i’ve put in coordinates.

Is it possible to be able to get driving distance from that field? Or would i have to do it with google maps API?

There was another question regarding distance but it seems to not involve driving distance; It involves straight line distance.


Sort of… Salesforce now has a DISTANCE() function which can be used in formula fields, but it is only “straigh-line” distance and not the distance you would travel is using roads.

I use this in a custom formula field today to help sales agents priortize and identify Leads nearest them.

One Example:
Distance between two geolocation fields

DISTANCE(warehouse_location__c, store_location__c, ‘mi’)

This formula
returns the distance, in miles, between the warehouse and the store.
In this example, warehouse_location__c and store_location__c are the
names of two custom geolocation fields.

To easily get driving directions, you can create a custom formula field with type of URL that will open GoogleMaps with the geocoordinates populated as parameters. You can use Merge fields in salesforce to get the lat/lon values for each geolocation.,-95.577&daddr=29.753,-95.577

saddr is your starting point
daddr is your destination

When the map loads, you can see driving distance and instantly get directions. What’s nice is this also works seamlessly on mobile devices from salesforce1 app.

Source : Link , Question Author : chrisjlee , Answer Author : James

Leave a Comment