# Understand the 8 points of encode polyline algorithm

 0 I must understand how encode polyline algorithm works and I follow this link: https://developers.google.com/maps/documentation/utilities/polylinealgorithm but I don't understand the 8 points? 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 what do you mean? asked 22 Oct '14, 18:16 scupetta18 -3●11●11●15 accept rate: 0% aseerel4c26 ♦ 32.6k●18●248●554

 0 This is an OpenStreetMap help forum. The Google polyline encoding algorithm is not on topic here even if it should be used by some software in conjunction with OSM. GIS Stack Exchange might be a better place to ask your question. answered 22 Oct '14, 18:40 Frederik Ramm ♦ 81.5k●92●714●1258 accept rate: 23% 2 It's perfectly on topic. Being able to work with the "Google polyline" algorithm is essential for the most popular OSM-based routing software. You may as well close down any questions about tile URLs because the scheme we use for that, too, was invented by Google. (23 Oct '14, 07:46) Richard ♦
 3 I'm assuming that you understand points 1-6; please say if not. Point 7 means that you reverse the order of the bytes. In other words, the last should be first, the second-to-last should be second, and so on. A B C D E becomes E D C B A. Point 8 means that you add 32 (the decimal representation of 0x20, which is a hex value) to all but the last value. This is used as a signal for 'another value follows'. For most languages, there is a ready-made polylines library that you can use, so you don't have to worry about the intricacies of encoding/decoding yourself. For Ruby: https://github.com/joshuaclayton/polylines. For JavaScript using Leaflet: https://github.com/jieter/Leaflet.encoded. answered 23 Oct '14, 07:57 Richard ♦ 30.8k●44●277●411 accept rate: 18%
 toggle preview community wiki:

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Question tags:

×84
×8
×8

question asked: 22 Oct '14, 18:16

question was seen: 6,253 times

last updated: 23 Oct '14, 13:34