Encoding polylines for Google Maps

If you want to display complicated path data on a Google Map, the most efficient way to do so is with an encoded polyline or polygon. The primary purpose of this page is to explain this encoding process. Most people interested in this discussion will be mathematically literate javascript programmers with a specific interest in the Google Maps API. A secondary purpose of this page is to provide some basic utilities to perform the encoding and only a passing familiarity with the Google Maps API is needed to use the code produced here.

Encoding utilities

Discussion

Ports

The polyline encoder has been implemented in several other programming languages. I have only used the Mathematica code, but the other programs appear to be direct ports of the code written here.


Valid XHTML 1.0 Transitional