PDA

View Full Version : use Latitude and longitude to calculate distance?



lengshuang
8th May 2009, 16:17
Hi
If I have known two points position by Latitude and longitude,then I want to calculate the distance,how can I make it out ?Can somebody get me the code?
Thanks !

wysota
8th May 2009, 17:53
What did you already try?

lengshuang
9th May 2009, 02:25
to wysota:
I don't know what you mean,mybe I should make my question more clearly,such as the
Latitude and longitude of Beijing :east longitude116°23′52.61″,north latitude39°54′29.42″,and the Latitude and longitude of Shenyang:east longitude123°24′59.07″,north latitude41°49′39.31″;how can I calculate the arc length of the Beijing and Shenyang?

I want to know How realize this function in Qt4,thanks!

wysota
9th May 2009, 09:02
I don't know what you mean,
I mean what did you do to solve your problem before coming here and asking the question.


how can I calculate the arc length of the Beijing and Shenyang?
Using proper math forumlas.


I want to know How realize this function in Qt4,thanks!

Qt has no support for calculating arc distances. Why would you think it did?

ChrisW67
9th May 2009, 22:39
You want the great circle path and distance.
http://en.wikipedia.org/wiki/Great_circle
http://en.wikipedia.org/wiki/Great-circle_distance

Be careful though, in some circumstances the errors in the floating point maths can be noticeable.

lengshuang
10th May 2009, 11:19
Thank you very much!

TheRonin
11th May 2009, 14:06
I can recommend the Vincenty formula as well: http://en.wikipedia.org/wiki/Vincenty%27s_formulae