Brian Dunning's FileMaker Custom Functions

HaversineDistance ( latx ; lony ; laty ; lony ; units )

compute shortest distance

  Average rating: 4.4 (27 votes) Log in to vote

john renfrew   john renfrew - Show more from this author
attitude

Share on Facebook Share on Twitter

  Sample input:
HaversineDistance ( 36.12 ; -86.67 ; 33.94 ; -118.4 ; "" )
  Sample output:
1794 mi 105.88 yds

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

The haversine formula is an equation important in navigation, returning great-circle distances between two points on a sphere from their longitudes and latitudes.

 

Comments

Tim Anderson   Tim Anderson, Tim Anderson Group
Mar 4, 2015
Just to repay the compliment John, you a typo or 2!


HaversineDistance ( latx ; lony ; lat y ; lony ; units )
should be


HaversineDistance ( latx ; lonx ; laty ; lony ; units )?

Tim
 
john renfrew   john renfrew, attitude
Mar 4, 2015
Tim
Well spotted Mr Darcy...
Jeremy Bante's custom function uses the more complex Andoyer-Lambert-Thomas method if the coordinates are in the WGS84 coordinate system, and is more accurate, but this is within 99.98% of that, so for use in short distance calculations is as effective

https://github.com/jbante/FileMaker-Techniques/blob/master/CustomFunctions/Location/LocationDistanceValues.fmfn
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: