Maps SDK for Web
Class L.RouteSummary
Widget to display additional route information in a panel over the map.
The panel contains an icon, distance and arrival time for the route.
This widget requires route data to work correcly. For more information please refer to our Routing with summary example.
Constructor
L.RouteSummary([options])
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | Options to setup control | No | Object | None |
options.size | Width and height in pixels for the panel | No | Number[] | [320,320] |
options.position | Where to add view | No | "topleft" | "topright" | "bottomleft" | "bottomright" | "topleft" |
options.imperialDistance | Set this option if you want to use a specific unit measurement system for the new instance of the widget. If no unit system is defined upon, the widget will use the global unit measurement configuration. | No | Boolean | null |
Example
var widget = new L.RouteSummary({
size: [270, 268],
position: 'topleft'
});
widget.addTo(map);
Methods
hide( )
Hides the route summary.
By default the summary will be hidden until the method updateSummaryData is called.
initialize([options])
Leaflet init method executed when adding control to map. Options will be stored inside control.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | Options to setup control | No | Object | None |
onAdd(map): HTMLElement
Leaflet method executed when adding control to map. Map will be stored inside control.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
map | The map instance to which control is added. | Yes | Object | None |
Returns
show( )
Shows the route summary.
By default summary will be hidden. Use this method to show the control after data is ready.
updateSummaryData(routeSummary, [useImperial=null])
Method to update data after route is recalculated.
Use this method to update data after each route calculation.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
routeSummary | Routing properties object | Yes | Object | None |
routeSummary.travelTimeInSeconds | Yes | Number | None | |
routeSummary.trafficDelayInSeconds | Yes | Number | None | |
routeSummary.lengthInMeters | Yes | Number | None | |
routeSummary.arrivalTime | Date in milliseconds or a string in RFC-3339 format | Yes | String | Number | None |
useImperial | If you set this parameter the unit system will be forced but only for this data | No | Boolean | null |