Goal
If I want to calculate the distance between two positions, how can I achieve this?
Learn
If you have two geohashes, you first need to decode them into latitude and longitude:
GEOHASH_DEC_LAT(#GeoHash) GEOHASH_DEC_LONG(#GeoHash)
After you have your coordinates you can calculate the distance:
IF(! ISBLANK(#Timestamp); (ACOS(COS(RADIANS(90-#LatitudeFrom)) *COS(RADIANS(90-#LatitudeTo)) +SIN(RADIANS(90-#LatitudeFrom)) *SIN(RADIANS(90-#LatitudeTo)) *COS(RADIANS(#LongitudeFrom-#LongitudeTo))) *3958.756); null)
whereby r = 3958.756 gives the distance in miles and r = 6371 in kilometer.
Comments
0 comments
Please sign in to leave a comment.