February 8th, 2010
I’m developing a GPS Windows Mobile application (personal for now, but I might make it public) and I wanted to find out (theory wise) how to get the speed I’m traveling when given 2 sets of coordinates. I would go out and capture 2 coordinates driving at a constant speed, but I was hoping there was a magic formula.
You probably need some BASIC trigonometric …..
(I can’t believe you know how to write computer program but not knowing this…..)
anyways….first, you need 2 points…assuming you measure those 2 points exactely 1 second apart.
assuming
Point one:
47.64753 degree North
122.38547 degree West
Point two:
47.64822 degree North
122.38585 degree West
you subtract each coord. point 1 and point 2 and you get
0.00069 degree
0.00038 degree
(make sure use absolute value!)
convert your degree to radian first and times the R then you will have distance.
0.00069 degree *3.141592654 / 180 = 1.20428E-05 radian
0.00038 degree *3.141592654 / 180 = 6.63225E-06 radian
Now….Times Radius of the earth of (6,371,000) meters on average
76.72449939 in the J direction (north and south)
42.25407213 in the I direction (east and west)
Now, you find the 3rd side of a right triangle
which is sequare root of 2 other side’s square
so square root of ( 76.72449939 ^2 + 42.25407213 ^2 )
=87.590 meters
so the car traveled 87.590 meters in 1 second
times that 3600 seconds = 315324.97 meters
or approx 315,325 km/hour
it shouldn’t be too hard to convert it to miles
(divide that number by 1.609344 )
you will get 195.93 miles per hour
now, 1 problem is that earth is actually a 3D surface.
so if your GPS get a 3D coordinate (even better) you may want to utilize that……
(You will calculate it base on X,Y, Z instead of just X and Y axis)
the only difference is the last part.
distance is square root of (side 1 ^2 + side 2 ^2 + side 3 ^2 )
Interesting question!
Posted in speed gps | 2 Comments »