Interactive Polyline Encoder Utility

This utility uses the Maps JavaScript API. Specifically, encoding and decoding of paths are handled by the static methods encodePath() and decodePath in the google.maps.geometry.encoding namespace. See 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, you can specify a level indicating that the location should appear on that level and any level higher (i.e., any increase in zoom.). If a location does not appear on a given level, then the line goes 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 can drag the marker to adjust the location.
  2. If necessary, specify the appropriate level for the location in the Display Level field.
  3. Click the Add Location button to add the location to the Locations list.
  4. Repeat for each location on your polyline.
  5. The polyline encoding appears in the Encoded Polyline and Encoded Levels fields. Use these values for locations and levels when you create your google.maps.Polyline.
  6. Click the Delete All Locations button to clear the Locations list before decoding a new polyline.