L.Wrld.map.routes

Methods

map.routes.getRoute(viaPoints, onLoadHandler, onErrorHandler, transportMode)

var _onRoutesLoaded = function(routes) {
    // ... use the returned route options
};

var _onRoutesError = function(err) {
    console.log(err);
};

// Get routes between the two provided points
map.routes.getRoute(
    [
        [-2.9786788,56.4602727, 2], // start point (indoors on 2nd level)
        [-2.9783117,56.4600344], // end point (outside)
    ],
    _onRoutesLoaded,
    _onRoutesError,
    "walking"
);

Get route options between the supplied indoor and/or outdoor points asynchronously, returning the results to the provided callback.

Argument Type Description
viaPoints [lon, lat, <level>] An array of [lon, lat] pairs specifying the coordinates the route should pass through, in the order they should be visited. A level can optionally be specified to indicate an indoor waypoint. This level parameter should match the level index of the indoor map floor that contains the waypoint.
onLoadHandler callback A callback taking an array of returned routes, as arrays of [lon, lat]. This is only called if no errors occurred.
onErrorHandler callback An optional callback taking some error JSON. This is only called if no routes could be acquired.
transportMode string An optional desired mode of travel for this route. Currently supported: “walking”. Defaults to “walking” if not provided. Note: “driving” routes are available for limited areas. Please contact support@wrld3d.com for details.
v0.1.1916