Google Maps can generate a simple polyline from two or more latitude/longitude coordinates.
Learn more about
[polyline encoding](https://developers.google.com/maps/documentation/utilities/polylinealgorithm.md.txt),
[simple polylines](https://developers.google.com/maps/documentation/javascript/examples/polyline-simple.md.txt),
and
[complex polylines](https://developers.google.com/maps/documentation/javascript/examples/polyline-complex.md.txt).

With this utility, you can generate polyline encodings interactively. You can also decode
polylines into coordinates from either an encoded string or a GeoJSON linestring.

**Create a polyline interactively on the map**

1. Enter an address, zip code, location, or landmark. Make a selection from the list of suggestions. The map centers on the location you selected.
2. Click the map to add markers to define your polyline. The coordinates of your markers show in the **Locations** list.
   - The **Locations** list shows the coordinates of the markers.
   - The **Encoded Polyline** box shows the polyline encoding.
   - The **GeoJSON Linestring** box shows the GeoJSON representation of the polyline.

**Editing coordinates**

- To edit a location, drag the marker on the map.
- To delete a location, click the "x" next to it in the **Locations** list.
- To delete all locations and start over, click **Clear All**.

**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 the **GeoJSON Linestring
  coordinates** box, using GeoJSON format.

**Decode a polyline into coordinates**

1. Paste your polyline into either the **Encoded Polyline** or **GeoJSON Linestring** box.
2. If your polyline contains escaped characters, click the **Unescape special characters** checkbox to unescape them.
3. Click **Decode Polyline** or **Decode GeoJSON** . The coordinates show in the **Locations list**, and the polyline is drawn on the map.

<br />

<iframe src="https://maps-docs-team.web.app/samples/polyline-utility/dist/" allow="fullscreen; fullscreen"></iframe>

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](https://developers.google.com/maps/documentation/utilities/polylinealgorithm) for information about the encoding scheme.