WrldRouteView

WrldRouteView is an optional widget for displaying routes from the WrldNavigation widget.

Dependencies

  • wrld.css
  • navigation.js
  • routeview.js

For an example of how to use the WrldRouteView widget, see this example.

Constructor

var routeviewConfig = {
    polyline: {
        weight: 10,
        defaultColor: "#0096ff",
        displayOption: "currentFloor"
    }
};
var routeview = new WrldRouteView(map, routeviewConfig);
Argument Type Description
map Wrld.map The map object that the routes will be displayed on.
options object An object containing optional parameters, described below.

Options

Options Type Default Description
polyline object * A set of options that defines how the Polylines are rendered, described below.

PolylineOptions

Options Type Default Description
weight number 17.5 Stroke width in pixels.
miterLimit number 10 The miter length is the distance in pixels between the inner corner and the outer corner where two lines meet.
elevation number 0 Altitude of the Polylines above ground level in meters.
defaultColor string ‘#0096ff’ The color of the Polylines.
displayOption string ‘currentFloor’ Controls when the Polyline should be displayed in an indoor map. Option ‘currentIndoorMap’ will draw the Polyline in the appropriate indoor map when any floor is selected; ‘currentFloor’ will draw the Polyline only on the current floor.

Methods

routeview.setDirections(directions)

Displays a route for a set of directions on the map.

Argument Type Description
directions Direction[] An array of directions which make up a complete route to be displayed.

routeview.clearDirections()

Clears the displayed route.

Data Types

This section describes the structure of the data types used by WrldRouteView, and the types of their fields.

Direction

Below is the structure of a Direction object which represents information about part of a route that will be displayed on the map. An array of Direction objects defines a complete route. Fields with a ? following them are optional and may be omitted. You can use the ‘directions’ from the WrldNavigation DirectionsResult

indoorMapId and indoorMapFloorId are required for indoor routes.

isMultiFloor is used to draw vertical Polylines between floors on indoor routes.

{
    "path": Wrld.LatLng[],
    "indoorMapId": string?,
    "indoorMapFloorId": number?,
    "isMultiFloor": boolean?
}
v1.1.0
Props Wrld.Prop
Themes Wrld.themes
Heatmaps Wrld.Heatmap
Events Event objects
Services (Optional) WrldPoiApi