Adds a path (Path) to the map.
Array of coordinates (Coordinate) to form the path.
Optionaloptions: { id?: string } & TAddPathOptionsOptional styling and behavior options (see TAddPathOptions).
A Path instance representing the created path.
const path = mapView.Paths.add([coord1, coord2], { color: '#ff0000' });
const directions = await mapView.getDirections(space1, space2);
if (directions) {
const path = mapView.Paths.add(directions.path, {
color: '#4b90e2',
showPulse: true,
animateDrawing: true,
displayArrowsOnPath: true
});
}
Clears the highlighted section of all paths.
Clears the highlighted section of a path.
The path to clear the highlight from.
Highlights a section of a path between two coordinates.
The path to highlight.
The start coordinate.
The end coordinate.
Optionaloptions: TPathSectionHighlightOptionsThe options for the highlight.
Paths in Mappedin JS
Paths allow you to draw custom routes on the map, from simple straight lines between coordinates to complex navigation paths that avoid obstacles. While Navigation provides complete turn-by-turn directions, Paths give you fine-grained control over route visualization.
Features
Example Usage
Path Styling Options
color: Path color (default: '#4b90e2')width: Path width. Can be a number or an Interpolation.showPulse: Animated pulse indicating directionanimateDrawing: Animate path drawingdisplayArrowsOnPath: Show direction arrowsdashed: Use dashed line styleAdvanced
interactive: trueto make paths clickable.More Information
This class is accessed using MapView.Paths.