PDA

View Full Version : Discussion Anybody know GPS Binary code


Tom Harper
Jun 28, 2007, 09:03 AM
I may be missing the obvious (again) but I don't understand the numbers in the Sirf lll Binary reference manual. The Longitude value is given as:

-2689140 M

Looks like UTM without zones. I assume it is the Easting value from Greenwich 0 in meters. Is that the case?

Would be an easier number to handle than Lat/Long.

Tom

404error
Jul 03, 2007, 06:22 AM
Well, that is 2689km (1.6km to the statute mile, gps uses the nautical mile which takes into account the curvature of the earth so is slightly longer) from some longitude, look on a globe and see if your area is that distance longitudinally from Greenwich. I believe the negative means the direction is East, I may be wrong

Tom Harper
Jul 03, 2007, 09:05 AM
Finally spent some time with Google. Found that the binary notation is in ECEF XYZ coordinates. Not trivial to deal with.

clolson
Jul 03, 2007, 11:29 AM
This may not help depending on what platform you are writing code for, but SimGear (www.simgear.org) is an LGPL'ed project that includes code to convert between ECEF and geodetic lon/lat/elev (or geocentric lon/lat/elev.) I'm sure there's many other examples of similar code floating around the net if you hunt for it. There's something called "proj" which apparently can convert between a huge variety of different coordinate systems and geods.

In some sense the problem is simply a matter of converting from a cartesian coordinate system to a polar coordinate system, except the result you get is called "geocentric" coordinates matching your real angles relative to the center of the earth, not the "observed" angle of the stars that we actually use.

Because the earth is an oblate ellipsoid (slightly flattened sphere) the real angle between our position and the equator is slightly different than what we observe based on the stars. Another way to say this is that once you are away from the equator or the poles, if you dig straight down, you won't pass exactly through the center of the earth.

If I'm being completely incoherent here, I drew up a picture a while ago to illustrate some of these concepts ...

http://www.flightgear.org/Docs/Scenery/CoordinateSystem/CoordinateSystem.html

Regards,

Curt.

Tom Harper
Jul 03, 2007, 12:17 PM
Curt,

Thanks for the clarification. The equations you give can be handled in integer math. That's doable in a cheap processor.

But, there may not be any advantage to using the binary form. Scaling a pair of (x,y) values, would be easier than dealing with the base 60 numbers in latitude and longitude. It looks the GPS device is doing some heavy lifting by handing out it's position in latitude and longitude. Probably should stick with that for now.

Thanks much,

Tom