Skip to content

Latest commit

 

History

History
100 lines (53 loc) · 2.14 KB

API.md

File metadata and controls

100 lines (53 loc) · 2.14 KB

Directions

L.mapbox.directions(options)

Extends: L.Class

Options Value Description
options object accessToken is a required property unless L.mapbox.accessToken is set globally. profile is optional and defaults to mapbox.driving.

directions.getOrigin()

Returns the origin of the current route.

Returns: the origin

directions.setOrigin()

Sets the origin of the current route.

Returns: this

directions.getDestination()

Returns the destination of the current route.

Returns: the destination

directions.setDestination()

Sets the destination of the current route.

Returns: this

directions.addWaypoint(index, waypoint)

Add a waypoint to the route at the given index. waypoint can be a GeoJSON Point Feature or a L.LatLng.

Returns: this

directions.removeWaypoint(index)

Remove the waypoint at the given index from the route.

Returns: this

directions.setWaypoint(index, waypoint)

Change the waypoint at the given index. waypoint can be a GeoJSON Point Feature or a L.LatLng.

Returns: this

directions.reverse()

Swap the origin and destination.

Returns: this

directions.query(opts)

Send a directions query request. opts can contain a proximity LatLng object for geocoding origin/destination/waypoint strings.

Returns: this

L.mapbox.directions.layer(directions, options)

Extends: L.LayerGroup

Create a new layer that displays a given set of directions on a map.

Options Value Description
options object readonly (optional). If set to true marker and linestring interaction is disabled.

L.mapbox.directions.inputControl

inputControl.addTo(map)

Add this control to a given map object.

Returns: this

L.mapbox.directions.errorsControl

errorsControl.addTo(map)

Add this control to a given map object.

Returns: this

L.mapbox.directions.routesControl

routesControl.addTo(map)

Add this control to a given map object.

Returns: this

L.mapbox.directions.instructionsControl