Add a polyline to a map

Select platform: Android iOS JavaScript

You can add a polyline to a 3D map.

A map view showing a polyline

The following code sample demonstrates how to use the Polyline struct to add a polyline and position it on the map.

  Polyline(coordinates: [
    .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)
    ]
    .stroke(.init(strokeColor: .red, strokeWidth: 5.0, outerColor: .blue, outerWidth: 0.2))
    .contour(.init(isGeodesic: false, extruded: true, drawOccludedSegments: true)))