Explanation sought concerning gps semicircles.

  • Thread starter Thread starter Peter Hamilton-Scott
  • Start date Start date
P

Peter Hamilton-Scott

Looking at the Garmin developers api it mentions that all positions
returned by their gps devices are represented internally as a number
of semicircles. For example latitude N51.7.0 is represented internally
as 609843842 semicircles. To convert this into d.m.s you'd convert it
with this, dms=semicircles*(180/2^31) and the math is correct.

Questions that puzzle me are...

Why semicircles? Why not circles, or rectangles, or triangles? What is
so intrinsically flawed with a circle that only half of it will do or
is necessary?

I just find this semicircle concept a bit weird but there is obviously
a good reason for it. Can anyone explain?

Regards.

Peter.
 
Peter said:
Looking at the Garmin developers api it mentions that all positions
returned by their gps devices are represented internally as a number
of semicircles. For example latitude N51.7.0 is represented
internally as 609843842 semicircles. To convert this into d.m.s
you'd convert it with this, dms=semicircles*(180/2^31) and the math
is correct.

Questions that puzzle me are...

Why semicircles? Why not circles, or rectangles, or triangles? What
is so intrinsically flawed with a circle that only half of it will
do or is necessary?

I haven't even seen the API you mentioned but it seems that the term
semicircle means simply 180 degrees. In other words, the used unit is a
fraction (1/2^31) of 180°. When you multiply the number of such units by the
conversion factor of (180/2^31), you get the measurement in degrees.
 
The mapping Garmin uses (180 degrees to 2^31 semicircles) allows them
to use a standard 32 bit unsigned integer to represent the full 360
degrees of longitude. Thus you get the maximum precision that 32 bits
allows you (about double what you'd get from a floating point value),
and they still get to use integer arithmetic instead of floating point
on the internal processor. Pretty cool design decision, actually.

Hal
 
The mapping Garmin uses (180 degrees to 2^31 semicircles) allows them
to use a standard 32 bit unsigned integer to represent the full 360
degrees of longitude. Thus you get the maximum precision that 32 bits
allows you (about double what you'd get from a floating point value),
and they still get to use integer arithmetic instead of floating point
on the internal processor. Pretty cool design decision, actually.

Hal

You can also move seamlessly across the 180 meridian, since the 32 bit
value overflows to produce the correct result. You do have to be
careful with comparisons across the 180 meridian though, using
"(a-b)<0" rather than "a<b".
- Colin.
 
The mapping Garmin...<snip>...Pretty cool design decision, actually.

Hal

Nice answer. I can now appreciate why they use it, cool, like you say.
I like your lil test program you wrote using the api. Works well!.
Thanks.
 
The mapping Garmin uses (180 degrees to 2^31 semicircles) allows them
to use a standard 32 bit unsigned integer to represent the full 360
degrees of longitude. Thus you get the maximum precision that 32 bits
allows you (about double what you'd get from a floating point value),
and they still get to use integer arithmetic instead of floating point
on the internal processor. Pretty cool design decision, actually.

Hal


You are one smart mofo.

Thanks,
Cherrie
 

Members online

Back
Top