Using lineId with canonical direction endpoint changes value returned

Hi guys,

I was using the StopPoint canonical direction endpoint to get the directions between two stations and noticed that when I use the lineId parameter it changes the result given:

When I get the direction starting at Romford (910GROMFORD) and ending at Liverpool Street (910GLIVST) without a lineId it says the direction is “inbound”

https://api.tfl.gov.uk/StopPoint/910GROMFORD/DirectionTo/910GLIVST

But when I add tfl-rail as a lineId it changes the direction returned to “outbound”

https://api.tfl.gov.uk/StopPoint/910GROMFORD/DirectionTo/910GLIVST?lineId=tfl-rail

Is there anything I’m missing here as I’m not sure why the direction would be different as both stations are on the same TfL Rail branch?

Welcome @dunglass

This is the problem with trying to define a single “Up” for Romford. For Greater Anglia and TfL Rail the inbound and outbound is easy as that point towards Zone 1.

However, for the Romford Upminster shuttle, this isn’t as easy because Upminster platform 6 is and Overground service on a single bidirectional line.

1 Like

Hi @briantist,

Thanks for replying to me!

I understand what you said about Romford but I’ve found this behaviour happens for other stations on the line

I wonder if this is a problem with the API and specifically this branch of TfL Rail as when I use other stations the same behaviour occurs. However it only happens when the end station is further east than Forest Gate (910GFRSTGT)

It happens with Manor Park (910GMANRPK)
https://api.tfl.gov.uk/StopPoint/910GLIVST/DirectionTo/910GMANRPK
https://api.tfl.gov.uk/StopPoint/910GLIVST/DirectionTo/910GMANRPK?lineId=tfl-rail

Ilford (910GILFORD)
https://api.tfl.gov.uk/StopPoint/910GLIVST/DirectionTo/910GILFORD
https://api.tfl.gov.uk/StopPoint/910GLIVST/DirectionTo/910GILFORD?lineId=tfl-rail

Brentwood (910GBRTWOOD)
https://api.tfl.gov.uk/StopPoint/910GLIVST/DirectionTo/910GBRTWOOD
https://api.tfl.gov.uk/StopPoint/910GLIVST/DirectionTo/910GBRTWOOD?lineId=tfl-rail

In all of these examples the direction changes when adding the line parameter. Specifically, it seems that when I want to filter by TfL Rail the direction returned is incorrect

I apologise if I’m not understanding what you are saying but I can’t seem to understand why the direction should change for all these stations

Hi

How does it compare with the “line view”?

https://api.tfl.gov.uk/line/tfl-rail/arrivals

(it’s there as .direction)

Hi,

Yeah - the data from this endpoint also seems to be a bit funky

Here’s some data for Goodmayes which has two trains going in opposite directions (one to Liverpool Street and one to Gidea Park) but they both have a direction property of inbound

Train to Liverpool Street:
“id”: “-173205027”,
“operationType”: 1,
“vehicleId”: “sXjAOzK6Ng03K6u1GNjCYQ”,
“naptanId”: “910GGODMAYS”,
“stationName”: “Goodmayes Rail Station”,
“lineId”: “tfl-rail”,
“lineName”: “TfL Rail”,
“platformName”: “Platform Unknown”,
"direction": “inbound”,
“bearing”: “”,
“destinationNaptanId”: “910GLIVST”,
“destinationName”: “London Liverpool Street Rail Station”,
“timestamp”: “2021-03-05T18:45:54.005769Z”,
“timeToStation”: 2706,
“currentLocation”: “”,
“towards”: “”,
“expectedArrival”: “2021-03-05T19:31:00Z”,
“timeToLive”: “2021-03-05T19:30:58Z”,

Train to Gidea Park:
“id”: “-1192470905”,
“operationType”: 1,
“vehicleId”: “tf5cYhYmo61FKpdBPOyY-Q”,
“naptanId”: “910GGODMAYS”,
“stationName”: “Goodmayes Rail Station”,
“lineId”: “tfl-rail”,
“lineName”: “TfL Rail”,
“platformName”: “Platform 4”,
"direction": “inbound”,
“bearing”: “”,
“destinationNaptanId”: “910GGIDEAPK”,
“destinationName”: “Gidea Park Rail Station”,
“timestamp”: “2021-03-05T18:45:54.005769Z”,
“timeToStation”: 966,
“currentLocation”: “”,
“towards”: “”,
“expectedArrival”: “2021-03-05T19:02:00Z”,
“timeToLive”: “2021-03-05T19:01:58Z”,

Looks like this could be a bug

Is there anyway for me to report this bug more formally or is there someone on the forum I can send this to?

@dunglass

I guess if it’s a bug or a feature!

Let’s ping @jamesevans