Skip to content

Instantly share code, notes, and snippets.

@ralfbecher
Created December 16, 2015 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ralfbecher/a4c22c35ee2f3ab43d6f to your computer and use it in GitHub Desktop.
Save ralfbecher/a4c22c35ee2f3ab43d6f to your computer and use it in GitHub Desktop.
QlikView Haversine formula calculation
// calculation of distance of two geo references (lat/lon):
= 12742 * atan2(sqrt(sqr(sin(((lat2-lat1)*PI()/180)/2))
+ (cos(lat1*PI()/180) * cos(lat2*PI()/180))
* pow(sin(((lon2-lon1)*PI()/180)/2),2)),
sqrt(1 - (sqr(sin(((lat2-lat1)*PI()/180)/2))
+ (cos(lat1*PI()/180) * cos(lat2*PI()/180))
* pow(sin(((lon2-lon1)*PI()/180)/2),2))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment