fix(tours): a city walk keeps to the bridges and avoids ferries

The walk was routed with the pedestrian router's default, which takes
ferries, so a walk through Venice went along the vaporetto lines across
the canals instead of over the bridges. A walk now asks for no ferries
(use_ferry 0), as a hike that avoids them does; where no way on land
exists the router still takes the ferry.
This commit is contained in:
Maurice
2026-10-20 11:32:03 +02:00
parent 3882feec5c
commit 54baf85a2a
2 changed files with 8 additions and 4 deletions
@@ -230,9 +230,9 @@ describe('routing on land, bike profiles and unreachable points (BIK-01)', () =>
).toEqual({ unreachable: 1, snappedMeters: 400 })
})
it('TOUR-ROUTING-033: a city walk goes on foot with no hiking limit and no choice of a hike (CW-01)', async () => {
it('TOUR-ROUTING-033: a city walk goes on foot with no hiking limit, no choice of a hike, and avoids ferries (CW-01)', async () => {
valhallaRun.mockResolvedValueOnce(run([3, 4]))
expect(await routeCityWalk(waypoints)).toMatchObject({ distanceMeters: 1500, durationSeconds: 300 })
expect(valhallaRun).toHaveBeenCalledWith(waypoints, 'walking', [], undefined, {})
expect(valhallaRun).toHaveBeenCalledWith(waypoints, 'walking', [], undefined, { use_ferry: 0 })
})
})
@@ -106,15 +106,19 @@ export async function routeWalkingTour(
/**
* CW-01: a city walk, on foot between its stations. No hiking limit is sent,
* so the router keeps to the ways it takes for walking anyway (T1), and no
* route choice of a hike.
* route choice of a hike. Ferries are avoided: a walk is walked, and with the
* router's default Venice was crossed on the vaporetto lines instead of the
* bridges. Where no way on land exists the router still takes the ferry.
*/
export async function routeCityWalk(
waypoints: LandWaypoint[],
signal?: AbortSignal,
): Promise<TourRouteResult | TourRouteUnreachable | null> {
return routeOnLand(waypoints, 'walking', {}, signal)
return routeOnLand(waypoints, 'walking', CITY_WALK_COSTING, signal)
}
const CITY_WALK_COSTING: Readonly<CostingOptions> = { use_ferry: 0 }
/** BIK-01: a bike tour, routed for its profile; a leg drawn by hand is kept as drawn. */
export async function routeBikeTour(
waypoints: LandWaypoint[],