Building an EV route planner: charging stops a car can actually use

Sample waypoints along a route, query each with a radius search, and keep only stations where a car gets a fast DC gun — the filters run on the server.

6 min read


## Overview A route planner needs the few stations near the road the driver will take, and only those the car can use. Half of the stations on BEE's list serve only two- and three-wheelers, so filtering by vehicle is not optional.

This guide uses /v1/stations/near. Every filter below runs on the server, so total_found and paging reflect exactly what the car can use.

1. One radius query per waypoint Step along the route's polyline every 40–60 km and run one query per point. `vehicle=car`, `current=dc` and `min_power_kw=50` are checked against a single gun, so a station with a slow AC point and a 30 kW DC gun does not slip through a 50 kW search.

javascript

async function fastStopsNear(point, radiusKm = 25) { const url = new URL(BASE_URL + '/v1/stations/near'); url.searchParams.set('lat', point.lat); url.searchParams.set('lng', point.lng); url.searchParams.set('radius', radiusKm); url.searchParams.set('vehicle', 'car'); url.searchParams.set('current', 'dc'); url.searchParams.set('min_power_kw', 50); url.searchParams.set('limit', 5);

const response = await fetch(url); const body = await response.json(); if (!body.success) throw new Error(body.error.code + ': ' + body.error.message); return body.data; }

// Bengaluru to Mysuru, roughly every 45 km const waypoints = [ { lat: 12.9716, lng: 77.5946 }, { lat: 12.7209, lng: 77.2799 }, { lat: 12.5223, lng: 76.8970 }, { lat: 12.2958, lng: 76.6394 }, ];

for (const point of waypoints) { const stops = await fastStopsNear(point); const best = stops[0]; console.log(point, best ? best.operator + ', ' + best.distance_km + ' km, CCS2 ' + best.max_kw_by_standard.CCS2 + ' kW' : 'no fast DC stop in range'); } ```

2. Read the power per gun, per standard `max_kw_by_standard` gives the strongest gun for each standard at the station, which is what a car receives. Each charger in `chargers` lists its `guns` with the standard and power of each one.

3. Never route to a suspect location Radius search never returns stations whose published coordinates are impossible (for example latitude equal to longitude). If you build from `/v1/stations` instead, pass `location_quality=ok`.

4. Gaps are real If a waypoint returns nothing, widen the radius up to 100 km or relax `min_power_kw`. The data has no live availability, so treat a listed station as a candidate, not a guarantee.