How to convert arc length to km?

14 Ansichten (letzte 30 Tage)
Leon
Leon am 11 Apr. 2021
Kommentiert: Leon am 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.

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 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:
https://www.mathworks.com/help/releases/R2021a/map/working-with-distances-on-the-sphere.html
  1 Kommentar
Leon
Leon am 11 Apr. 2021
It works! That's exactly what I want.
Many thanks.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by