How are the distances for on and off site calculated?

  • Updated

Firstly, let us define a few terms: 

Customer Co-Ordinates: The GPS co-ordinates linked to a customer (either saved during the first visit, or manually added / edited by a user).

Visit Co-Ordinates: The first reliable GPS co-ordinates received after a visit has started.

On - Site: The customer's GPS co-ordinates are within an acceptable distance of the Visit Co-ordinates

Off - Site: The customer's GPS co-ordinates are not within an acceptable distance of the Visit Co-ordinates

The distance between these two points is calculated using the  Haversine formula , a very well known formula in navigation. We then apply an "error margin" to this distance (based on the accuracy of the co-ordinates, as well as the actual distance in order to allow for some correction).

For the "tech nerds" out there, here are the formulas we use:

Distance between points in meters:

ROUND((6371*1000*2*ATN2(SQRT(SQUARE(SIN((PI()*[Customer_Activities.Latitude]/180.0-PI()*[Customers.Latitude]/180.0)/2))+COS(PI()*[Customers.Latitude]/180.0)*COS(PI()*[Customer_Activities.Latitude]/180.0)*SQUARE(SIN((PI()*[Customer_Activities.Longitude]/180.0-PI()*[Customers.Longitude]/180.0)/2))),SQRT(1-(SQUARE(SIN((PI()*[Customer_Activities.Latitude]/180.0-PI()*[Customers.Latitude]/180.0)/2))+COS(PI()*[Customers.Latitude]/180.0)*COS(PI()*[Customer_Activities.Latitude]/180.0)*SQUARE(SIN((PI()*[Customer_Activities.Longitude]/180.0-PI()*[Customers.Longitude]/180.0)/2))))),2)

 Customer locations (Latitude and Longitude)

  [Customers.Latitude][Customers.Longitude]

Visit location (Latitude and Longitude)

  [Customer_Activities.Latitude][Customer_Activities.Longitude]

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.