Shop OBEX P1 Docs P2 Docs Learn Events
Lats and Lons — Parallax Forums

Lats and Lons

ArchiverArchiver Posts: 46,084
edited 2003-08-14 16:21 in General Discussion
Hi all

Given the limitations of no floating point math, does anyone know of a way
to calculate distance between to sets of lats/lons say to the nearest
kilometer?

Regards, Peter

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-08-14 14:10
    In a message dated 8/14/2003 6:51:20 AM Eastern Standard Time,
    manager@s... writes:


    > Given the limitations of no floating point math, does anyone know of a way
    > to calculate distance between to sets of lats/lons say to the nearest
    > kilometer?
    >

    Are you talking Great Circle or straight-line distances?

    Sid Weaver
    W4EKQ
    Port Richey, FL


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-14 14:26
    Straight line.

    Sorry.
    Regards, Peter

    Original Message
    From: Newzed@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=GSz77USflxBzl3kDHqNv1qgRWyZemSLqTImDsn2z94I9TVy2v9E2UpU69W9K2-VmU9QFUw]Newzed@a...[/url
    Sent: Thursday, August 14, 2003 11:11 PM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Lats and Lons


    In a message dated 8/14/2003 6:51:20 AM Eastern Standard Time,
    manager@s... writes:


    > Given the limitations of no floating point math, does anyone know of a
    > way to calculate distance between to sets of lats/lons say to the
    > nearest kilometer?
    >

    Are you talking Great Circle or straight-line distances?

    Sid Weaver
    W4EKQ
    Port Richey, FL


    [noparse][[/noparse]Non-text portions of this message have been removed]


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



    --
    This message has been scanned for viruses and
    dangerous content by MailScanner, and is
    believed to be clean.

    --
    This message has been scanned for viruses and
    dangerous content by MailScanner, and is
    believed to be clean.
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-14 14:54
    You will have to do some conversions and scaling there and back, but the
    [noparse][[/noparse]newly documented] HYP function will help you. Knowing the X and Y
    offset between two points, it will tell you the distance between them.

    -- Jon Williams
    -- Parallax


    Original Message
    From: Peter May [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=GMncyvdfuUYRjfyFrQmq_KF0EdQxwC3gRwMxMDEprGfJaE-zto0lj0LIam2e7sU5-C8VHc9I1bscOuWwDLI]manager@s...[/url
    Sent: Thursday, August 14, 2003 8:26 AM
    To: 'basicstamps@yahoogroups.com'
    Subject: RE: [noparse][[/noparse]basicstamps] Lats and Lons


    Straight line.

    Sorry.
    Regards, Peter

    Original Message
    From: Newzed@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=098QJMi9LNKS8wmDcWjBeZ-VyVEoAI3pCeJR53Q9yeIQykd1UhD7NQPdSuxVGEY9tfXjEPC7]Newzed@a...[/url
    Sent: Thursday, August 14, 2003 11:11 PM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Lats and Lons


    In a message dated 8/14/2003 6:51:20 AM Eastern Standard Time,
    manager@s... writes:


    > Given the limitations of no floating point math, does anyone know of a
    > way to calculate distance between to sets of lats/lons say to the
    > nearest kilometer?
    >

    Are you talking Great Circle or straight-line distances?

    Sid Weaver
    W4EKQ
    Port Richey, FL


    [noparse][[/noparse]Non-text portions of this message have been removed]


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/



    --
    This message has been scanned for viruses and
    dangerous content by MailScanner, and is
    believed to be clean.

    --
    This message has been scanned for viruses and
    dangerous content by MailScanner, and is
    believed to be clean.


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-14 15:06
    Peter May wrote:
    >
    > Hi all
    >
    > Given the limitations of no floating point math, does anyone know of a way
    > to calculate distance between to sets of lats/lons say to the nearest
    > kilometer?

    A good approximation of distance and course, in mid-latitudes,
    for distances > 1200 miles or so...

    Compute the absolute difference between Latitudes & Longitudes

    Lat1 41d 26'N Lon1 71d 23'W (Brenton Reef Light, off
    R.I.)
    Lat2 32d 22'N Lon2 64d 39'W (St.David's Light, Bermuda)

    DLat 9d 04'S = 544' DLon 6d 44'E = 404'E

    Compute the absolute difference of DLat/2 and Lat1

    1/2 DLat 4d 32'S
    Lat1 41d 26'N
    Lm 36d 54'N

    p = DLon x cos Lm
    = 404 x cos 36d 54'
    = 323 miles

    tan Course = p / DLat
    = 323 / 544 = .594 = S 30d 42'E

    so the true course is 180d - 30d 42' = 149d 18'E

    and distance is Dlat / cos Course, so

    d = 544' / cos 30d 42'
    = 633 miles

    Seems to me this could be turned into STAMPlish, though I have'nt
    tried. Accuracy is good enough for sailboat navigation - You cruise
    missile guys will have to look elsewhere.

    Jack
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-14 15:28
    > A good approximation of distance and course, in mid-latitudes,
    > for distances > 1200 miles or so...

    Should be " < 1200 miles ", of course.

    Jack
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-14 15:36
    You can find documentation for HYP and ATN (also newly discovered) in
    the online help. Be sure to download the latest Beta compiler so that
    you have the most up-to-date docs. As soon as the compiler is finalized
    we will move the new online information to our printed manual.

    -- Jon Williams
    -- Parallax



    Original Message
    From: goflo@p... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=HgsdRsISTZv0Ch8HU-ylECWus2MxKEI2efIGoyJJQq6EU0Gl7GsSWC3h3-FqndBIwkRBvSMVtSK5pg]goflo@p...[/url
    Sent: Thursday, August 14, 2003 10:22 AM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Lats and Lons


    Jon Williams wrote:
    > ... the [noparse][[/noparse]newly documented] HYP function ...

    Hi Jon -

    Where are the new function docs?

    thanks, Jack


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-14 16:21
    Jon Williams wrote:
    > ... the [noparse][[/noparse]newly documented] HYP function ...

    Hi Jon -

    Where are the new function docs?

    thanks, Jack
Sign In or Register to comment.