Results 1 to 7 of 7

Thread: use Latitude and longitude to calculate distance?

  1. #1
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question use Latitude and longitude to calculate distance?

    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 !

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: use Latitude and longitude to calculate distance?

    What did you already try?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: use Latitude and longitude to calculate distance?

    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!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: use Latitude and longitude to calculate distance?

    Quote Originally Posted by lengshuang View Post
    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?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: use Latitude and longitude to calculate distance?

    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.

  6. #6
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Smile Re: use Latitude and longitude to calculate distance?

    Thank you very much!

  7. #7
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use Latitude and longitude to calculate distance?

    I can recommend the Vincenty formula as well: http://en.wikipedia.org/wiki/Vincenty%27s_formulae

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.