Join us for our next
Google Maps Platform Developer Community Day in San Francisco in December!
Apply now to attend.
Add a polyline to a map
Stay organized with collections
Save and categorize content based on your preferences.
You can add a polyline to a 3D map.
The following code sample demonstrates how to use the
Polyline
struct to add a polyline and position it on the map.
Polyline(
path: [
.init(latitude: 37.7749, longitude: -122.4194, altitude: 100),
.init(latitude: 37.7750, longitude: -122.4193, altitude: 100),
.init(latitude: 37.7751, longitude: -122.4192, altitude: 100)
],
altitudeMode: .clampToGround
)
.stroke(.init(strokeColor: .green, strokeWidth: 5.0))
.contour(.init(geodesic: false))
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-10-22 UTC.
[null,null,["Last updated 2026-10-22 UTC."],[],[]]