Maneuver

A Maneuver represents a single step of a TripLeg — for example "Turn left on the walkway" or "Take the stairs to Floor 1". Each maneuver carries a human-readable instruction along with timing, distance, and positioning data.

map.nav().directions(waypoints, function (error, trip) {
  trip.leg().maneuvers().each(function (maneuver) {
    console.log(maneuver.instruction());
  });
});

Maneuver.id

The unique identifier of the Maneuver.

Maneuver.type()

Get the type of the Maneuver — e.g. the kind of turn or transition it represents.

Returns

A String.

Maneuver.time()

Get the estimated duration of the Maneuver, in seconds.

Returns

A Number.

Maneuver.distance()

Get the distance of the Maneuver, in feet.

Returns

A Number.

Maneuver.instruction()

Get the human-readable instruction for the Maneuver — e.g. "Turn left on the walkway.".

Returns

A String.

Maneuver.center()

Returns the position in map space which will center the Maneuver within the viewport (screen space).

// Translate the map to center over the maneuver:

map.panTo(maneuver.center());

Returns

An [x, y] coordinates Array.

Maneuver.bounds()

Get the bounding box of the Maneuver.

// Zoom and pan the map to fit the maneuver.

map.fitBounds(maneuver.bounds(), { padding: 100 });

Returns

A bounding box as a nested Array of the form [[minX, minY], [maxX, maxY]], suitable for passing to UnitMap.fitBounds.

Maneuver.properties()

Get any user-defined properties associated with the Maneuver, sourced from the waypoint that produced it.

Returns

An object.

Maneuver.floor()

Get the Floor the Maneuver takes place on.

Returns

A new Floor instance.