Hi,

I seem to have picked up an omission in the algorithm given in
"Encoded Polyline Algorithm Format" API documentation found at
http://code.google.com/apis/maps/documentation/polylinealgorithm.html

The steps are as follows:

7. Place the 5-bit chunks into reverse order:
00001 11111 10000 01010 00010 00001
8. OR each value with 0x20 if another bit chunk follows:
100001 111111 110000 101010 100010 000001

The example shows that the last 5-bit chunk is not OR'ed with 0x20.
This can be confirmed in the Javascript for the "Interactive Polyline
Encoder Utility" (http://code.google.com/apis/maps/documentation/
polylineutility.html):

// Encode an unsigned number in the encode format.
function encodeNumber(num) {
  var encodeString = "";

  while (num >= 0x20) {
    encodeString += (String.fromCharCode((0x20 | (num & 0x1f)) + 63));
    num >>= 5;
  }

  encodeString += (String.fromCharCode(num + 63));
  return encodeString;
}

"while (num >= 0x20)" ensures that all the chunks except the last one
(or first, depending on your perspective) are OR'ed with 0x20.

The steps should read something like:

7. Place the 5-bit chunks into reverse order:
00001 11111 10000 01010 00010 00001
8. OR each value except the last chunk with 0x20 if another bit chunk
follows:
100001 111111 110000 101010 100010 000001

Regards

Nicolas.

P.S. I'm sure this isn't the right spot to report this omission in the
documentation, but hopefully you will be able to pass it on to the
right people.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to