Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Convert Latitude and Longitude coordinates to distance (km)?

arundaka02
8 - Asteroid

Hi everyone

 

I have a table with latitude and longitude coordinates which are reflective of a journey from London to Edinburgh. The table has 105,000 rows. 

 

Does anyone know how I might be able to convert / translate the distance between point A and B into km, to look something like this: 

 

LatitudeLongitudeDistance Travelled (km)
51.5040464-0.01459310
51.50405-0.014591
51.50405-0.01462
51.50407-0.014663
51.50414-0.014784
51.50413-0.014815
51.50412-0.014836

 

The following article explains how this can be done mathematically, but was wondering if anyone had any pre-loaded Formula tool or configured Spatial tools which could easily do this?

 

https://sciencing.com/convert-distances-degrees-meters-7858322.html

 

Thanks

KA

3 REPLIES 3
Qiu
20 - Arcturus
20 - Arcturus

@arundaka02 
It is quite rare to have a spatial question asked.

 

0115-arundaka01.PNG

arundaka02
8 - Asteroid

Thank you @Qiu 

 

I've not used the Multi Row Formula tool before, but am I right in thinking it effectively has created a new row and calculated the distance in KM from the coordinates in the first row??

 

Thanks,

KA

ChrisTX
15 - Aurora

Separate from the spatial functions, I've been using this formula to calculate distance in feet:

 

131332796.6 *
(ACOS
(Cos([Row-1:Latitude]) * Cos([Row-1:Longitude]) * Cos([Latitude]) * Cos([Longitude]) +
Cos([Row-1:Latitude]) * Sin([Row-1:Longitude]) * Cos([Latitude]) * Sin([Longitude]) +
Sin([Row-1:Latitude]) * Sin([Latitude]))
/360)

 

Based on this information:

 

How to Convert GPS Coordinates to Feet

 

https://sciencing.com/convert-gps-coordinates-feet-7695232.html


Use the following formula to calculate the distance in feet of the shortest line across the surface of the earth that joins the two locations represented by GPS coordinates (a1, b1) and (a2, b2):

 

131332796.6 x (ArcCos{Cos[a1]xCos[b1]xCos[a2]xCos[b2] + Cos[a1]xSin[b1]xCos[a2]xSin[b2] + Sin[a1]xSin[a2]}/360)

 

where a1,b1 = latitude, longitude for location one
where a2,b2 = latitude, longitude for location two

 

Tips
Check that the calculator you are using has the degree mode selected before attempting these calculations. Calculations done using the calculator's radian mode will result in errors.

 

Chris

Labels