Hi guys, I know I’m like a year late but I got it to work! @drted’s api solution was great but network here in my country is quite slow and it would be a pain on bad days and even worse for a batch requests if I had to use a for loop. It works in degrees as of testing and you can see the blocks below as well a sample test I did. I double checked with radians in excel and it returned the same answer.

**TEST**

**BLOCKS**

The link to the project is here. I would think everyone on this thread figured it out by now but if you didn’t, or if it’s someone like me who saw this but couldn’t get the **acos** to work as intended, hope this helps! Now we should be able to rip the coordinates from wherever (e.g api response) and plug them right into the function on the client side.

For anyone who want to know more information, this method uses the *haversine* formula with the respective formulae below:

**DEGREES**

d = r * ( (pi/180) * acos( (sin(lat1) * sin(lat2)) + cos(lat1) * cos(lat2) * cos(lng2 - lng1) ) )

**RADIANS** ( e.g lat radian = lat/(180/pi) )

d = r * acos( (sin(lat1) * sin(lat2)) + cos(lat1) * cos(lat2) * cos(lng2 - lng1) )

“r” is the radius of the earth in the units you want (miles, metres, kilometres…) so you can use whichever you prefer, I just ripped them straight from google in the example.

##
Edits Summary

**EDIT**

- Added the project link
- Forgot to add that multiplying the acos by pi/180 allows us to convert this to radians for the formula to work if your acos/asin/atan is in degrees

**EDIT 2**

- Added that it is the haversine formula
- Spelling errors