encoding and decoding of paths are handled by the static methods
decodePath in the
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.
- Click on the map to place the first location of your polyline. You can drag the marker to adjust the location.
- If necessary, specify the appropriate level for the location in the Display Level field.
- Click the Add Location button to add the location to the Locations list.
- Repeat for each location on your polyline.
- The polyline encoding appears in the Encoded Polyline and
Encoded Levels fields. Use these values for
levelswhen you create your