Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/16/08 15:44
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#149570 - Much better
Responding to: ???'s previous message
Ap said:
Language problem , here I think I have written enough English, but maybe not enough :) . I would need to update every second my vehicle GPS coordinates , all other are stationary . I have said earlier , my vehicle is moving , it searches the telemetry and list the received coordinates. It then reads its own coordinates in real time , and it then has to calculate the approaching most nearby node the roadside out of all listed nodes. I feel I have explained my requirement here , if still I am not able to explain correctly please ask for clarification.

That is much better. I think I understand now. Here is what I would do:
Calculate north-south distance:

    Y = latitude A - latitude B

Calculate east-west distance:

    X = longitude A - longitude B

Adjust east-west distance for latitude

    XA = X * cos(latitude A)

Calculate total distance:

    D = square root ((XA * XA) + (Y * Y))

Notes:

1.  The distances in these formulas are expressed in degrees of
    latitude along the surface of the Earth, so one degree is
    equivalent to roughly 69 miles.

2.  For calculating the cosine function, you have several options:
    A) Write your program in a HLL and use its library function,
    B) Use a table lookup or some other simple approximation.  C)
    If you know that you will always be operating within a narrow
    range of latitudes, consider simply using a constant for
    cos(latitude A).

3.  If you are only interested in finding the closest object, and
    don't care about the actual distances, you don't have to
    compute the square root in the last step.  Just calculate the
    value ((XA * XA) + (Y * Y)) for each case and compare those
    results to find the closest object.

-- Russ



List of 32 messages in thread
TopicAuthorDate
Global positioning algorithm            01/01/70 00:00      
   Global?            01/01/70 00:00      
   Ehm what do you receive?            01/01/70 00:00      
      coordinates            01/01/70 00:00      
         Length/absolute value of a vector ?            01/01/70 00:00      
         How do they know?            01/01/70 00:00      
         An old greek...            01/01/70 00:00      
            What about doppler            01/01/70 00:00      
               not doppler & math            01/01/70 00:00      
                  Haversine formula is it accurate for short distanc            01/01/70 00:00      
               Are you thinking of D-VOR            01/01/70 00:00      
            An old greek... not accurate enough for            01/01/70 00:00      
               Well, you're stating that it's a 2D space.            01/01/70 00:00      
                  Well, you're stating that it's a 2D space.            01/01/70 00:00      
                     So how wide are your roads?!            01/01/70 00:00      
               You said approximate            01/01/70 00:00      
               Some questions            01/01/70 00:00      
                  Answers to Cooper            01/01/70 00:00      
                     Plane should be fine, then            01/01/70 00:00      
                        Plane should be fine, then            01/01/70 00:00      
                           If you have cartesian coordinates ...            01/01/70 00:00      
                           complex math trough LUT            01/01/70 00:00      
                              Fixed point            01/01/70 00:00      
                                 Scaling            01/01/70 00:00      
                     You have wide roads, then!            01/01/70 00:00      
                        That's still wide!            01/01/70 00:00      
                     Much better            01/01/70 00:00      
                         Much better            01/01/70 00:00      
                           Adjusting for latitude            01/01/70 00:00      
                              Thanks            01/01/70 00:00      
                  Not entirely true            01/01/70 00:00      
                     You\'re right            01/01/70 00:00      

Back to Subject List