Interactive Polyline Encoder Utility (original) (raw)

Google Maps can generate a simple polyline from two or more latitude/longitude coordinates. Learn more aboutpolyline encoding,simple polylines, andcomplex polylines.

With this utility, you can generate polyline encodings interactively on a map or by entering coordinates. You can also decode polylines into coordinates by using this tool in reverse.

However, if you have an existing encoded polyline or a list of coordinates as aGeoJSON linestring and want to view the polyline on a map, use theInteractive polyline decoder utility.

Create a polyline interactively on the map

  1. Enter an address, zip code, location, or landmark to center the map and click Search.
  2. Click the map to place a marker that represents the start location of your polyline.
  3. The coordinates of your marker show in the Latitude and Longitude boxes.
  4. Click the Add Location button. This adds the coordinates to the Location list and generates an encoding in the Encoded Polyline box.
  5. Continue to place markers on the map to add all locations on your polyline to the Location list and the Encoded polyline.

Editing coordinates

Create a polyline by entering coordinates

Decode a polyline into coordinates

  1. Enter your polyline into the Encoded Polyline box.
  2. If your polyline contains escaped characters, click the checkbox to unescape them.
  3. Click Decode Polyline. The coordinates show in the Location list, and the line is drawn on the map.

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.