Journey Planner: station is found with Naptan code, not with latitude and longitude

I am loolking for trains going from London Bridge to Brighton (East Sussex)

The query below leads to a disambiguation response because Brighton railway station is not found

Query:
https://api.tfl.gov.uk/Journey/JourneyResults/51.505017171569%2C-0.086092080684152/to/50.829002883622%2C-0.14128035620038?date=20210510&time=1300&timeIs=Departing&journeyPreference=LeastInterchange&mode=national-rail%2Cwalking%2Ctflrail%2Cinternational-rail&accessibilityPreference=NoRequirements&nationalSearch=true

Response
{
“$type”: “Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationResult, Tfl.Api.Presentation.Entities”,
“toLocationDisambiguation”: {
“$type”: “Tfl.Api.Presentation.Entities.JourneyPlanner.Disambiguation, Tfl.Api.Presentation.Entities”,
“matchStatus”: “notidentified”
},
“fromLocationDisambiguation”: {
“$type”: “Tfl.Api.Presentation.Entities.JourneyPlanner.Disambiguation, Tfl.Api.Presentation.Entities”,
“matchStatus”: “identified”
},
“viaLocationDisambiguation”: {
“$type”: “Tfl.Api.Presentation.Entities.JourneyPlanner.Disambiguation, Tfl.Api.Presentation.Entities”,
“matchStatus”: “empty”
},
“recommendedMaxAgeMinutes”: 1440,
“searchCriteria”: {
“$type”: “Tfl.Api.Presentation.Entities.JourneyPlanner.SearchCriteria, Tfl.Api.Presentation.Entities”,
“dateTime”: “2021-05-10T13:00:00”,
“dateTimeType”: “Departing”
},
“journeyVector”: {
“$type”: “Tfl.Api.Presentation.Entities.JourneyPlanner.JourneyVector, Tfl.Api.Presentation.Entities”,
“from”: “-0.086092080684152:51.505017171569:WGS84[DD.dddd]”,
“to”: “-0.14128035620038:50.829002883622:WGS84[DD.dddd]”,
“via”: “”,
“uri”: “/journey/journeyresults/51.505017171569,-0.086092080684152/to/50.829002883622,-0.14128035620038?date=20210510&time=1300&timeis=departing&journeypreference=leastinterchange&mode=national-rail%2cwalking%2ctflrail%2cinternational-rail&accessibilitypreference=norequirements&nationalsearch=true”
}
}

However, if I use the Naptan code for Brighton station the response code is 200 and everything works fine
https://api.tfl.gov.uk/Journey/JourneyResults/51.505017171569%2C-0.086092080684152/to/9100BRGHTN?date=20210510&time=1300&timeIs=Departing&journeyPreference=LeastInterchange&mode=national-rail%2Cwalking%2Ctflrail%2Cinternational-rail&accessibilityPreference=NoRequirements&nationalSearch=true

Does that meant I should always the Naptan codes in all cases to get the proper response?

Thank you for your insight on this

Welcome @Vincent

If I remember correctly, stations outside London are included by TfL for reference, rather than as primary places. If you want to plan for National Rail, use the NRE OJP - https://www.nationalrail.co.uk/100299.aspx

Thank you Brian, that makes sense :slight_smile:

1 Like