Description
On the Results page, route polylines are drawn as straight lines connecting each stop
in sequence instead of following the actual road network (streets, turns, one-ways).
This misrepresents the real driving path and makes the on-map distance/route look
nothing like what a driver would actually drive.
The map already intends to draw road-following routes: RoutePolylinesOverlay calls
Google's DirectionsService and only draws a straight polyline as a fallback
(drawFallback, app/ui/src/app/results/components/Map.tsx#L140-L150). In practice every route renders as the fallback,
which means the directions request is either failing, returning no overview_path, or
being skipped. Likely causes to check:
- Directions API not enabled / not authorized for the Maps API key
(NEXT_PUBLIC_GOOGLE_MAPS_KEY) — the catch at L224-L230 logs
"DirectionsService failed, falling back to straight line".
- Routes with more than 25 waypoints hit the hard fallback at L163-L166.
result.routes[0].overview_path empty/missing → fallback at L196-L200.
Goal
Route polylines on the Results page follow the real road network between consecutive
stops instead of drawing straight lines.
Reproduction
Steps
- From a clean state, build a route (add addresses + a vehicle) and run Optimize.
- Open the Results page.
- Observe the route line connecting the depot and each stop on the map.
Expected: The polyline follows the drivable roads and turns between each stop,
matching the path a driver would take.
Actual: The polyline is a straight line directly between each consecutive stop.
Environment: branch main. Check the browser console for the
"DirectionsService failed, falling back to straight line" warning, and confirm whether
the Maps key has the Directions API enabled.
Scope
In scope
- Diagnose why
DirectionsService results aren't being used and ensure road-following
polylines render for normal routes on the Results page.
- Confirm the Directions API is enabled/authorized for the configured Maps key (or
document the required config).
Out of scope
- Routes exceeding the 25-waypoint Directions limit (the straight-line fallback there
is acceptable for now; splitting into multiple legs is a separate follow-up).
- Changing the optimization/solver output or stop ordering.
- The mobile app and driver-view map.
Acceptance Criteria
Assignee
@KesarSidhu
Description
On the Results page, route polylines are drawn as straight lines connecting each stop
in sequence instead of following the actual road network (streets, turns, one-ways).
This misrepresents the real driving path and makes the on-map distance/route look
nothing like what a driver would actually drive.
The map already intends to draw road-following routes:
RoutePolylinesOverlaycallsGoogle's
DirectionsServiceand only draws a straight polyline as a fallback(
drawFallback, app/ui/src/app/results/components/Map.tsx#L140-L150). In practice every route renders as the fallback,which means the directions request is either failing, returning no
overview_path, orbeing skipped. Likely causes to check:
(
NEXT_PUBLIC_GOOGLE_MAPS_KEY) — the catch at L224-L230 logs"DirectionsService failed, falling back to straight line".
result.routes[0].overview_pathempty/missing → fallback at L196-L200.Goal
Route polylines on the Results page follow the real road network between consecutive
stops instead of drawing straight lines.
Reproduction
Steps
Expected: The polyline follows the drivable roads and turns between each stop,
matching the path a driver would take.
Actual: The polyline is a straight line directly between each consecutive stop.
Environment: branch
main. Check the browser console for the"DirectionsService failed, falling back to straight line" warning, and confirm whether
the Maps key has the Directions API enabled.
Scope
In scope
DirectionsServiceresults aren't being used and ensure road-followingpolylines render for normal routes on the Results page.
document the required config).
Out of scope
is acceptable for now; splitting into multiple legs is a separate follow-up).
Acceptance Criteria
rather than a straight line.
onRouteDistanceUpdate), notstraight-line distance.
unavailable, and does not throw.
Assignee
@KesarSidhu