new EvSmartRouting(context, optionsopt)
BeNomad BeMap JavaScript API - EvSmartRouting service (v1.5)
Promise-based wrapper around `POST service/2.0/evsmartrouting` (REST v2.0.0).
**What it does.** Given a start, a stop, and a vehicle key, the service
plans an EV journey that respects the battery's state of charge — adding
charging stops where needed using the configured CSP(s). The response
carries the journey summary (distance, duration, charging time, CO2)
plus an ordered list of `EvStepPoint`s with energy budgets and the
route polyline.
Auth: requires `ROLE_EVSMARTROUTING`. The CSP(s) must be in the user's
allowed list (see `bemap.helpers.listChargingStationProviders`).
Typical usage:
var router = new bemap.EvSmartRouting(ctx);
var req = new bemap.EvSmartRoutingRequest({
start: new bemap.Coordinate(2.35, 48.85),
stop: new bemap.Coordinate(4.83, 45.75),
vehicle: 'renault-megane-e-tech-ev60',
chargingStationProviders: ['ecoMovement'],
initBatteryLevel: 80,
minBatteryLevel: 10,
minArrivalBatteryLevel: 20
});
router.calculate(req).then(function(response) {
drawPolyline(response.getPolyline());
response.getStepPoints().forEach(addChargingMarker);
summary(response.getDistance(), response.getDuration(), response.getChargingTime());
});
Parameters:
| Name |
Type |
Attributes |
Description |
context |
bemap.Context
|
|
BeMap-JS-API Context. Mandatory. |
options |
Object
|
<optional>
|
|
- Since:
- Source:
Plan an EV journey with optional charging stops.
Fetch the list of EV brands the current user has access to. Wraps
`GET service/evsmartrouting/vehiclebrands/list/1.0`.
Raw `brands[]` array (each entry has `id` and `name`).
Fetch the list of EV vehicle models. Wraps
`GET service/evsmartrouting/vehiclemodels/list/1.0`.
Raw `vehicles[]` array.