deg2km command does not calculate distance between two points

조회 수: 9 (최근 30일)
Hülya Sukas
Hülya Sukas 2020년 1월 28일
댓글: Hülya Sukas 2020년 1월 31일
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