Skip to content

getNearbyStopIDs only returns first nearby stop (truncates nearbyStopIds) #190

@Bhup-GitHUB

Description

@Bhup-GitHUB

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

  1. Call
    GET /api/where/arrivals-and-departures-for-stop/{stopId}.json?key=...
  2. Use a stop located in an area with multiple nearby stops.
  3. Inspect data.entry.nearbyStopIds.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions