Interactive Polyline Encoder Utility

Google Maps can generate a simple polyline from two or more latitude/longitude coordinates.
Learn more about polylines, simple polylines, and complex 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 a GeoJSON linestring and want to view the polyline on a map, use the Interactive 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

  • To delete a location, select it in the Location list and press Delete Selected Location.
  • To delete all locations and start over, click Delete All Locations.
  • You cannot edit locations. To edit a location, delete and re-add it. If the location is not at the end of your list, delete the location and all the ones following.

Create a polyline by entering coordinates

  • If you have an existing list of coordinates, instead of placing markers, you can manually enter the latitudes and longitudes in their respective boxes.

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.