Function addPolyline
- addPolyline(
map: Map,
options: PolylineLayerOptions,
fetchOptions?: RequestInit,
): Promise<
{
polylineLayerId: string;
polylineOutlineLayerId: string;
polylineSourceId: string;
},
>Parameters
- map: Map
Map instance to add a polyline layer to
- options: PolylineLayerOptions
Options related to adding a polyline layer
- fetchOptions: RequestInit = {}
When the polyline data is loaded from a distant source, these options are propagated to the call of
fetch
Returns Promise<
{
polylineLayerId: string;
polylineOutlineLayerId: string;
polylineSourceId: string;
},
> - map: Map
Was this helpful?
Add a polyline to the map from various sources and with builtin styling. Compatible sources:
The method also gives the possibility to add an outline layer (if
options.outlineistrue) and if so , the returned propertypolylineOutlineLayerIdwill be a string. As a result, two layers would be added.The default styling creates a line layer of constant width of 3px, the color will be randomly picked from a curated list of colors and the opacity will be 1. If the outline is enabled, the outline width is of 1px at all zoom levels, the color is white and the opacity is 1.
Those style properties can be changed and ramped according to zoom level using an easier syntax.