Home > @magiclane/maps-sdk > RouteBookmarks > add

RouteBookmarks.add() method

Adds a new route or updates an existing one in this bookmarks collection.

Stores a route identified by name together with its waypoints and optional preferences. When a route with the same name already exists the operation will fail unless overwrite is set to true, in which case the existing route is replaced.

Only route-relevant preference fields are persisted.

Signature:

add(name: string, waypoints: Landmark[], preferences?: RoutePreferences | null, overwrite?: boolean): void;

Parameters

Parameter

Type

Description

name

string

Unique name identifying the route.

waypoints

Landmark[]

Ordered list of Landmark objects defining the route.

preferences

RoutePreferences | null

(Optional) Optional RoutePreferences to store with the route. If null, a default set of preferences will be used.

overwrite

boolean

(Optional) When true, overwrite an existing route with the same name. Defaults to false.

Returns:

void