Amenity stops along the route
EV drivers frequently like to hand pick charging locations based on specific nearby amenities.
The getRouteStationsWithAmenities query returns charging stations along an existing route that are within walking distance of specific amenity categories, while also listing for each station the nearby amenities by name. This lets drivers plan their charging stop around a specific amenity, like their favorite restaurant chain or a coffee place with outdoor area.
How it works
Adding an amenity stop to a route takes four steps:
- Create a route.Request a route with
createRoute. - Select a route option.Select one of the route options returned by the
routesubscription orgetRoutequery. - Search for stations with amenities.Pass the choosen route option as
route_idand the route request id returned bycreateRouteasroute_request_idtogetRouteStationsWithAmenities, . You’ll get a list of compatible stations along the route, each with the specific amenity places nearby . - Recalculate the route with the selected station.Once the driver picks the station, call
createRouteagain and add the station to theviainput as a charging stop usingvia.properties.station.station_id. See Route with stops for details on how this works.
How stations are selected
A station is included in the results only if it meets all of the following criteria:
| Criterion | Description |
|---|---|
| Travel window | The station is reached within the requested time window (center ± margin), measured in seconds of travel time from the start of the route. |
| Vehicle compatibility | The station has at least one connector compatible with the vehicle used in the original route. |
| Distance from route | The station is within the maximum allowed distance from the route path. |
| Amenity match | At least one amenity of the requested type is within the allowed walking distance of the station. |
If no stations meet all criteria, try widening your time window margin or relaxing your filters.
Examples
Search for stations with a coffee shop around 1 hour into the trip
Search for compatible stations with a coffee shop within walking distance, reached between 45 and 75 minutes into the trip (center: 3600, margin: 900).
Recalculate a route with the selected amenity station and a 45-minute stop
After the driver selects a station, create a new route that includes it as a charging stop. Setting stop_duration to 2700 tells the route planner the driver will stay at least 45 minutes, so charging is optimized around the lunch break.
Was this content helpful?