Back to all examples
Add Stops to Route
Find stops along a route within a one-minute detour and insert them all at optimal positions in a single call.
Two waypoints go in, a route comes back, and the chargers beside it join it as extra stops, in along-route order, on a single recalculation.
discoverPlacestakes the route itself as an input, so “along this route, within this detour” is a query rather than a post-filter.withInsertedWaypointsprojects old and new stops onto the route and orders them, so the insert positions are not yours to work out.RoutingModule.showRoutesandshowWaypointsredraw the updated journey straight from the service response, with no layer bookkeeping.
Related examples
Along route search
Search for EV charging stations along a route using the along-route search API
Getting Started
Routing
Search and Geocoding
Electric Vehicles
Web
React Route Planner
Search, add and drag stops, set how long you stay at each, and follow the trip on a timeline of its road sections.
Playground
Routing
Search and Geocoding
Electric Vehicles
User Interaction Events
Web
React
Geometry searches along a route
Searching along a route using buffer polygons to search along its line
Getting Started
Routing
Search and Geocoding
Geometry
Web
Routing Composite
Chain four routing services into one map: geocode the stops, plan a route with a pause, search along it, and show what is reachable from the destination.
Getting Started
Routing
Search and Geocoding
Web