-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Bug: getNearbyStopIDs returns only a single nearby stop ID
Summary
The nearbyStopIds field in the arrivals-and-departures-for-stop response is intended to represent a list of nearby stops, but the helper function getNearbyStopIDs currently returns at most one nearby stop ID.
Current Behavior
getNearbyStopIDs iterates over stops returned by GtfsManager.GetStopsForLocation(...), but due to the current loop logic it:
- Overwrites the result slice instead of accumulating values
- Exits after the first non-matching stop
As a result, nearbyStopIds is usually either empty or contains only one element even when multiple nearby stops exist.
Expected Behavior
nearbyStopIds should include all nearby stop IDs returned by the nearby-stops lookup (excluding the queried stop itself), up to the configured limit.
Steps to Reproduce
- Call
GET /api/where/arrivals-and-departures-for-stop/{stopId}.json?key=... - Use a stop located in an area with multiple nearby stops.
- Inspect
data.entry.nearbyStopIds. - Observe that it contains at most one stop ID.
Impact
Clients relying on nearbyStopIds to present alternative nearby boarding locations (or to expand arrival coverage around a stop) cannot do so accurately, since the response does not include the full nearby stop set.
Contribution
I’d love to work on fixing this issue.