How to convert arc length to km?

21 views (last 30 days)
Leon on 11 Apr 2021
Commented: Leon on 11 Apr 2021
My goal is to find a good function to calculate the distance for two points for millions of data points. I found the fucntion lldistkm in the FileExchange. Unfortunately, that function does not seem to work well for column data. It only works well for single data points.
Lon1 = -78.1982;
Lat1 = 33.8282;
Lon2 = -77.5003;
Lat2 = 32.8499;
Distance_km = lldistkm([Lat1, Lon1],[Lat2, Lon2])
Distance_arc = distance(Lat1, Lon1, Lat2, Lon2)
Here is my question. If I will rely on the Matlab function distance (see above) in the mapping toolbox to calcualte the distance. It's results will be in arc length? How do I convert it from arc length to km? Their ratio should be around 111 depending on the latitude.
So rad2km is the wrong function? It does not give me a number close to 111 at all.
Many thanks.

Accepted Answer

Sean de Wolski
Sean de Wolski on 11 Apr 2021
Arc length from the distance function is the distance. It will be in units of the ellipsoid or the value of the fifth input argument:
  1 Comment
Leon on 11 Apr 2021
It works! That's exactly what I want.
Many thanks.

Sign in to comment.

More Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!