====== Distance Between - Driving (Expression Function) ====== //This function is available in Platform Versions 14.05.948 and above.// ===== Purpose ===== The **Distance Between - Driving** function (DISTANCE_BETWEEN_DRIVING) calculates the distance between two points on Earth via driving directions. {{ :distance_between_driving_initial.png?nolink |}} ===== Parameters ===== This function has a variable number of parameters depending on the data being used: To pass the source and destination locations using Latitude and Longitude then the first four parameters should be: * Source Latitude * Source Longitude * Destination Latitude * Destination Longitude -OR- To pass the source and destination locations using [[Field Type - Address|Address Field]] values then the first two inputs should be: * Source Address Field (Stored Value) * Destination Address Field (Stored Value) -OR- To pass the source and destination locations using Address Field parts, the first eight inputs should be: * Source Street * Source City * Source State * Source Zip * Destination Street * Destination City * Destination State * Destination Zip -AND- Regardless of the source and destination input method the following parameters can follow the source and destination inputs. All of these parameters are optional and their default value is in bold. * Distance Units (**"mi"**, "km") * Use Premium Data ("yes" | **"no"**) * Route Type (**"fastest"** | "shortest" | "pedestrian" | "walking and public transport" | "bicycle") * Avoid Highways ("yes" | **"no"**) * Avoid Toll Roads ("yes" | **"no"**) ===== Output ===== The output of the **Distance Between - Driving** function is a number representing the distance between two points in the units requested. ===== Example ===== For example, the distance between 304 Market St. Harrisburg, PA and 304 Market St. San Francisco CA would be calculated by : DISTANCE_BETWEEN_DRIVING(40.261081,-76.880648,37.792335,-122.397622) would result in the Miles value: 2772.2856 DISTANCE_BETWEEN_DRIVING(40.261081,-76.880648,37.792335,-122.397622,"km") would result in the Kilometer value: 4461.5601 For comparison, the straight line distance between would be: DISTANCE_BETWEEN(40.261081,-76.880648,37.792335,-122.397622) would result in the Miles value: 2422.34723361 DISTANCE_BETWEEN(40.261081,-76.880648,37.792335,-122.397622,"km") would result in the Kilometer value: 3898.14958963