Google Maps API

Interactive Polyline Encoder Utility

This utility has been updated to utilize Google Maps Javascript API V3. In specific, encoding and decoding of paths is now handled by the google.maps.geometry.encoding static methods encodePath() and decodePath. Consult the Encoded Polyline Algorithm Format for information about the encoding scheme.

Polylines in Google Maps are formed as a set of latitude/longitude pairs. In addition, for each vertex (location) in an encoded polyline, a level can be specified indicating that the location should appear on that level and any level higher (i.e. any decrease in zoom.). If a location does not appear on a given level, then the line will go from the last visible location to the next visible location. Note that the first and last locations must be Level 3 points, otherwise the polyline won't display on all levels.

You can use this interactive utility to compute the encoding for a polyline.

1. Click on the map to place the first location of your polyline. You may drag the marker to adjust the location of the location.
2. If necessary, specify the appropriate level for the location in the "Min zoom level" field.
3. Click the "Add Location" button to add it to the Locations List.
4. Repeat for each location of your polyline.
5. The polyline encoding will appear in the Encoded Polyline and Encoded Levels fields below. Use these values for locations and levels when you create your google.maps.Polyline.