Methods

clearFeatureCollection

Clears the paths from the map.

getFeatureCollection

Get the current FeatureCollection drawn.
Returns GeoJSON.FeatureCollection<GeoJSON.Geometry>

getLineString

Get the current drawn FeatureCollection and concatenates the collection as a LineString. The properties contain path and point elements that helps Mapbox-gl-path reconstruct the feature collection. Returns Feature<LineString>

setFeatureCollection

Parameter: GeoJSON.FeatureCollection<GeoJSON.Geometry>

The featureCollection includes features that can be of type Point or Linestring.
A Linestring can be a line between points or a phantom junction line (the latter must have a isPhantomJunction properties equals to true).

setLineString

Parameter: GeoJSON.Feature<LineString>

It draws the lineString on the map.
If the lineString does not contains path and point properties to describe how to build a feature collection, automatic Points will be added :

  • If the first and last point have the same coordinate, the lineString is considered to be looped so one point will be placed at that coordinate and two others will be placed at equal distance from each other.
  • Otherwise, two points will be added to the edges.

setLoopTrail

It will draw the path between the last point and the first point only if point count is greater than 3.

setOneWayTrail

It will remove the path between the last point and the first point.