Parameters

All of the following parameters are optional.

{
directionsThemes: DirectionsTheme[] | undefined;
featureCollection: GeoJSON.FeatureCollection<GeoJSON.Geometry> | undefined;
layersCustomisation: LayersCustomisation | undefined;
lineString: GeoJSON.Feature<LineString> | undefined;
themeSelectionType: ThemeSelectionType | undefined;
translate: Function | undefined;
useRightClickToHandleActionPanel: boolean | undefined;
}

directionsThemes

DirectionsTheme[] | undefined

directionsThemes is an array listing all the themes for providing directions.
Each directionTheme has its own parameters:

ParametersTypeDescription
idnumberUnique identifier
namestringThe name and label of the provider. It will be displayed on the map to select this direction.
getPathByCoordinates(coordinates: number[][]) => Promise<DirectionsThemeResponse>The getPathByCoordinates function should return an object of type DirectionsThemeResponse with the coordinates between two points, waypoints and, if necessary, phantom junctions lines between waypoints and points.
interface DirectionsThemeResponse {
coordinates: number[][];
waypoints: Waypoints | undefined;
}
interface Waypoints {
departure: number[];
arrival: number[];
}

featureCollection

GeoJSON.FeatureCollection<GeoJSON.Geometry> | undefined

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 equal to true).

layersCustomisation

LayersCustomisation | undefined

layersCustomisation parameter allows to define an infinite number of layers for each Point or Linestring in order to easily style them.

interface LayersCustomisation {
lineLayerList: LayerCustomisation[];
phantomJunctionLineLayerList: LayerCustomisation[];
pointLayerList: LayerCustomisation[];
}
interface LayerCustomisation {
id: string | undefined;
layout: AnyLayout;
paint: AnyPaint;
type: string | undefined;
}

lineString

GeoJSON.Feature<LineString> | undefined

Like featureCollection parameter, 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.

If featureCollection parameter is set, this lineString parameter is ignored.

themeSelectionType

ThemeSelectionType | undefined

type ThemeSelectionType = "select" | "radioList";

Determines the HTML element for theme selection. Default set to radioList.

translate

Function | undefined

A function to provide locales. The locales are the following :

{
"gl-pathControl.followDirection": "Follow direction",
"gl-pathControl.enableFollowDirectionMode": "Enable direction with: {{theme}}",
"gl-pathControl.disableFollowDirectionMode": "Disable direction",
"gl-pathControl.createPoint": "Create point",
"gl-pathControl.createIntermediatePoint": "Create intermediate point",
"gl-pathControl.deletePoint": "Delete point",
"gl-pathControl.loopPoint": "Round trip",
"gl-pathControl.oneWayPoint": "One way"
}

useRightClickToHandleActionPanel

boolean | undefined

Boolean to use right or left mouse click to open the action panel. Default value is false (so left click).