MGLPolyline object represents a shape consisting of two or more vertices,
CLLocationCoordinate2D instances, and the line segments that
connect them. For example, you could use an polyline to represent a road or the
path along which something moves.
You can add polyline shapes to the map by adding them to an
object. Configure the appearance of an
MGLVectorSource’s polylines collectively using an
Alternatively, you can add a polyline overlay directly to a map view using the
-[MGLMapView addAnnotation:] or
-[MGLMapView addOverlay:] method. Configure
a polyline overlay’s appearance using
-[MGLMapViewDelegate mapView:strokeColorForShapeAnnotation:] and
The vertices are automatically connected in the order in which you provide
them. The first and last vertices are not connected to each other, but you can
specify the same
CLLocationCoordinate2D as the first and last vertices in
order to close the polyline. To fill the space within the shape, use an
MGLPolygon object. To group multiple polylines together in one shape, use an
To make the polyline straddle the antimeridian, specify some longitudes less than −180 degrees or greater than 180 degrees.
A polyline is known as a LineString geometry in GeoJSON.
Creates and returns an
MGLPolylineobject from the specified set of coordinates.
+ (nonnull instancetype)polylineWithCoordinates: (nonnull const CLLocationCoordinate2D *)coords count:(NSUInteger)count;
convenience init(coordinates coords: UnsafePointer
The array of coordinates defining the shape. The data in this array is copied to the new object.
The number of items in the
A new polyline object.