Brian Dunning's FileMaker Custom Functions

Distance ( lat1 ; lon1 ; lat2 ; lon2 )

Calculate distance between two geo points in kilometers.

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

Dmitriy Bogdan   Dmitriy Bogdan
CIA
http://fmpug.ru

Share on Facebook Share on Twitter

  Sample input:
Distance ( 45,034942 ; 38,976032 ; 45,237589 ; 38,125435 )
  Sample output:
70,4222851120227746

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

The haversine formula is an equation important in navigation, giving great-circle distances between two points on a sphere from their longitudes and latitudes. It is a special case of a more general formula in spherical trigonometry, the law of haversines, relating the sides and angles of spherical triangles.

 

Comments

Duncan Rhodes   Duncan Rhodes, UK
Dec 4, 2015
Hi

Thanks for the formula. What would I need to do to find the mileage between a start and end UK postcode?

Any help would be greatly appreciated please.
 
Kyle   Kyle, WA
Jul 10, 2016
Filemaker does not allow the line: "dtor = 57,2958;"
The comma within the number seems to be what is producing the "lists are not allowed here" error...

Is there something Im missing? Is there another custom dtor function for this? Please help..
 
Dwight   Dwight, Red Deer, Alberta Canada
Aug 28, 2017
I was having the same issue as Kyle. I tried putting in a decimal and the numbers seem to be correct.
 

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.

Under construction. Email me your wish list for improvements.