derhuerst / vbb-rest

An HTTP API for Berlin & Brandenburg public transport.
https://v6.vbb.transport.rest/
ISC License
133 stars 12 forks source link

stations/query does not return any stations #50

Open Colum31 opened 2 years ago

Colum31 commented 2 years ago

When I try to query a station by the name, the API always returns an empty response.

To reproduce (the example in the documentation):

curl 'https://v5.vbb.transport.rest/stations?query=mehringd' -s | jq

Best regards Daniel

derhuerst commented 2 years ago

I will look at this once I'm back at my computer, probably on Tuesday.

If you want to dig into this in the meantime, the logic for this is in vbb-stations-autocomplete.

derhuerst commented 2 years ago

This happens because vbb-rest#5 uses an outdated version of vbb-stations (^4), which contains a list of all VBB stations. For now, I suggest using the /locations?query=… route, which uses HAFAS underneath instead of vbb-stations:

curl 'https://v5.vbb.transport.rest/locations?query=mehringd&addresses=false&poi=false&results=3' -s | jq
[
    {
        "type": "stop",
        "id": "900000017101",
        "stationDHID": "de:11000:900017101",
        "name": "U Mehringdamm",
        "location": {
            "type": "location",
            "id": "900017101",
            "latitude": 52.49357,
            "longitude": 13.388138
        },
        "products": {
            "suburban": false,
            "subway": true,
            "tram": false,
            "bus": true,
            "ferry": false,
            "express": false,
            "regional": false
        },
    },
    // …
]