Class: EvSmartRouting

bemap.EvSmartRouting(context, optionsopt)

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:
  • 1.5.0
Source:

Extends

  • bemap.ServiceV2

Methods

calculate(request, optionsopt) → {Promise.<bemap.EvSmartRoutingResponse>}

Plan an EV journey with optional charging stops.
Parameters:
Name Type Attributes Description
request bemap.EvSmartRoutingRequest
options Object <optional>
Properties
Name Type Attributes Description
signal AbortSignal <optional>
AbortSignal for cancellation.
Source:
Returns:
Type
Promise.<bemap.EvSmartRoutingResponse>

getBrands(optionsopt) → {Promise.<Array.<Object>>}

Fetch the list of EV brands the current user has access to. Wraps `GET service/evsmartrouting/vehiclebrands/list/1.0`.
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Description
signal AbortSignal <optional>
Source:
Returns:
Raw `brands[]` array (each entry has `id` and `name`).
Type
Promise.<Array.<Object>>

getVehicles(optionsopt) → {Promise.<Array.<Object>>}

Fetch the list of EV vehicle models. Wraps `GET service/evsmartrouting/vehiclemodels/list/1.0`.
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Description
vehicle String <optional>
Filter by vehicle key.
brandId String <optional>
Filter by brand id.
signal AbortSignal <optional>
Source:
Returns:
Raw `vehicles[]` array.
Type
Promise.<Array.<Object>>