deg2km command does not calculate distance between two points

7 次查看(过去 30 天)
Hello everyone.
I am trying to calculate distance between two geographical coordinates and I want to convert geographical coordinates to the km. Therefore I used deg2km function. However, I realize that it is not convert points properly.
For instance, I used these two points.
p_x=[5; 10]; %degree
p_y=[8; 16]; %degree
pos_y=deg2km(p_y,6378);
pos_x=deg2km(p_x,6378);
It returns as:
pos_x= [556.58549846099 1113.17099692198]
pos_y= [890.536797537587 1781.07359507517]
When I calculate distance ( sqrt((556.5-1113.2)^2+(890.5368-1781.1)^2) ) between these points I obtained distance as : 1050.2464
However I checked it google map and also other websites it should be 1042 km.
Do you have any suggestion to calculate distance and also points as kilometers properly?
Thanks in advance!

回答(1 个)

Priyanshu Mishra
Priyanshu Mishra 2020-1-31
Hi Hülya,
Distance given by the deg2km depens on what radius of earth you are considering. Default value given in MATLAB documentation is 6371 km. You considered radius as 6378 km that is why there are differences in the values of distances. Also, the metric you are considering for calculating the distance sqrt(x^2+y^2) is not completely correct, since in case of earth there are other factors also involved because of it's shape.
  1 个评论
Hülya Sukas
Hülya Sukas 2020-1-31
Hi Priyanshu. It tried another radius too. But it is not match distance that I calculated with google map or another websites. Do you have any suggestions?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Geodesy and Mapping 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by