How to convert arc length to km?

14 vues (au cours des 30 derniers jours)
Leon
Leon le 11 Avr 2021
Commenté : Leon le 11 Avr 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.

Réponse acceptée

Sean de Wolski
Sean de Wolski le 11 Avr 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 commentaire
Leon
Leon le 11 Avr 2021
It works! That's exactly what I want.
Many thanks.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by