Which side the doors open...unifiedAPI?


Does anyone have any info on whether there is any information on which side the doors open for the trains?



In the UK, trains and cars both run on the left hand side. This is not always the case in all countries.

This means that in MOST cases, if a station has Island Platfom then the doors open on the right, and where there is an Side Platform the train doors open on the left.

The “famous” exceptions on the Underground are where the running was changed to Right Handed to create for Cross Platform Interchanges


Also there are (a few) stations where you can get out both sides (the “Spanish solution”) such as Platform 3/3a at Stratford.

At most terminal stations you can’t 100% predict which platform a train will arrive at. Some (Victoria Line Walthamstow Central, Brixton and Jubilee Line Stratford 14/15 ) operate a step-back system where the drivers change trains (so the trains can depart quicker than it takes a a train driver to walk the platform length).

This is why, I suspect, this useful dataset isn’t in the API.


There IS an FOI request for the data about the track layouts, which is here

The PDF can be got from here

which looks like this…


There are 3D versions of all the stations in this FOI request…

For example


Thanks @briantist - All this info is really helpful for Jamie and I!
Is there a correlation across the network between platform numbers and which side the doors will open?

We were thinking about possibly using the public facing Trackernet Api to get the platform number a train will be arriving on, then calculate it that way.

For terminating stations we are not concerned, as everyone will be leaving the train.


I think the way they usually work is the most southerly platform is numbered “1”, except where they aren’t (on the DLR).

It’s not that helpful a convention because stations don’t all align east-west.

Short answer: no.

Longer answer: look here http://carto.metro.free.fr/cartes/metro-tram-london/



Me again!

I just remembered this morning, the other site I was going to suggest you could grab the data for left-right opening doors from.

It’s called Clive’s UndergrounD Line Guides https://www.davros.org/rail/culg/

It does have the data about platform numbers and opening sides in it

The pages DO have the platform number data encoded in the alt property if wanted to scrape the data…



Hi Briantist!

Thanks for the comprehensive reply, and sorry for my late reply! Thanks very much for the PDFs and even more for the Davros link!! Saves me manually aggregating the dataset :sweat_smile:

I’ll have a look at scraping the dataset and posting it here!


Here’s my version of the scrape and interpretation.

Full text at: https://ukfree.tv/styles/images/2018/whichsideout.txt

Bakerloo.Harrow & Wealdstone                      left left                     =NS=ns=ns=          1,2,3,4             [=NS=ns=ns=]
Bakerloo.Kenton                                   left left                     =NS= nsns           2,1                 [=NS= nsnsX]
Bakerloo.South Kenton                             right                         N=S nsns            1                   [N=S nsnsX]
Bakerloo.North Wembley                            left left                     =NS= nsns           2,1                 [=NS= nsnsX]
Bakerloo.Wembley Central                          left left                     =NS=ns=ns=          1,2,3,4             [=NS=ns=ns=]
Bakerloo.Stonebridge Park                         left left                     =NS=                2,1                 [OPX]
Bakerloo.Harlesden                                left left                     =NS=                2,1                 [OPX]
Bakerloo.Willesden Junction                       right right                   N= T=S              2,1                 [N= T=SX]
Bakerloo.Kensal Green                             left left                     =NS=                2,1                 [OPX]
Bakerloo.Queen's Park                             left left                     ns =ns= n=NS=s      4,3,2,1             [ns =ns= n=NS=sX]
Bakerloo.Kilburn Park                             right right                   N==S                1,2                 [CP]
Bakerloo.Maida Vale                               right right                   N==S                1,2                 [CP]
Bakerloo.Warwick Avenue                           right right                   N==S                1,2                 [CP]
Bakerloo.Paddington                               right right                   N==S                3,4                 [CP2]
Bakerloo.Edgware Road (2)                         left left                     =NS=                1,2                 [OP]
Bakerloo.Marylebone                               left left                     =NS=                1,2                 [OP]
Bakerloo.Baker Street                             right  left                   N=-=n/S=-=s         9,10,8,7            [N9=-=10n/S8=-=7s]
Bakerloo.Regent's Park                            left right                    =N =S               1,2                 [=N =S]
Bakerloo.Oxford Circus                            left left                     n==NS==s            6,4,3,5             [n6==4NS3==5s]
Bakerloo.Piccadilly Circus                        left left                     =NS=                1,2                 [OP]
Bakerloo.Charing Cross                            right right                   N==S                1,2                 [CP]
Bakerloo.Embankment                               left left                     =NS=                5,6                 [OP4]
Bakerloo.Waterloo                                 right left                    N= S=               3,4                 [N3= S4=]
Bakerloo.Lambeth North                            right right                   N==S                1,2                 [CP]
Bakerloo.Elephant & Castle                        right right                   N==S                3,4                 [CP2]



I’ve done some more work on the data and fixed all the errors in the original. So, there’s now a new version at https://ukfree.tv/styles/images/2018/whichsideout.txt

Linename.StationName                         Platform:doorsOpenSide                            LayoutCodeCorrected       PlatformsInLayoutCode 
Central.Ealing Broadway                      5:right 6:left                                    =we==we= T==T t==tt=      1,2,3,4,5,6,7,8,9     
Central.West Acton                           1:right 2:right                                   =WE=                      1,2                   
Central.West Ruislip                         1:right 2:left                                    T==T =nss=                1,2,3,4               
Central.Ruislip Gardens                      1:left 2:left                                     W==E ns                   1,2                   
Central.South Ruislip                        1:left 2:left                                     W==E =nns=                1,2,3,4               
Central.Northolt                             1:left 2:left                                     W==E b                    1,2                   
Central.Greenford                            1:left 3:left                                     W==t==E ns                1,2,2,3               
Central.Perivale                             1:left 2:left                                     W==E ns                   1,2                   
Central.Hanger Lane                          1:left 2:left                                     W==E ns                   1,2                   
Central.North Acton                          1:right 2:both 3:left                             =WB==E b                  1,2,3                 
Central.East Acton                           1:right 2:right                                   =WE=                      1,2                   
Central.White City                           4:right 3:both 2:both 1:right                     E==B==W                   4,3,2,1               
Central.Shepherd's Bush                      1:left 2:left                                     W==E                      1,2                   
Central.Holland Park                         1:left 2:left                                     W==E                      1,2                   
Central.Notting Hill Gate                    4:left 3:right                                    W=/E=                     4,3                   
Central.Queensway                            1:left 2:left                                     W==E                      1,2                   
Central.Lancaster Gate                       1:left 2:left                                     W==E                      1,2                   
Central.Marble Arch                          1:left 2:left                                     W==E                      1,2                   
Central.Bond Street                          1:left 2:left                                     W==E                      1,2                   
Central.Oxford Circus                        1:left 2:left                                     W==E                      1,2                   
Central.Tottenham Court Road                 1:left 2:left                                     W==E                      1,2                   
Central.Holborn                              1:right 2:right                                   =WE=                      1,2                   
Central.Chancery Lane                        2:right 1:left                                    E=/W=                     2,1                   
Central.St. Paul's                           1:left 2:right                                    W=/E=                     1,2                   
Central.Bank                                 5:left 6:left                                     W==E                      5,6                   
Central.Liverpool Street                     5:left 4:left                                     W==E                      5,4                   
Central.Bethnal Green                        1:left 2:left                                     W==E                      1,2                   
Central.Mile End                             1:left 4:left                                     W==we==E                  1,2,3,4               
Central.Stratford                            3a:right 3:left 6:right                           v==v =W==wE==ew=          4a,4b,3a,3,5,6,8,10   
Central.Leyton                               1:right 2:right                                   =WE=                      1,2                   
Central.Leytonstone                          1:left 2:right 3:right                            W==WE=                    1,2,3                 
Central.Snaresbrook                          1:right 2:right                                   =WE=                      1,2                   
Central.South Woodford                       1:right 2:right                                   =WE=                      1,2                   
Central.Woodford                             1:left 2:right 3:right                            V==WE=                    1,2,3                 
Central.Buckhurst Hill                       1:right 2:right                                   =WE=                      1,2                   
Central.Loughton                             1:left 2:both 3:both 4:left                       W==B==E                   1,2,3,4               
Central.Debden                               1:right 2:right                                   =WE=                      1,2                   
Central.Theydon Bois                         1:right 2:right                                   =WE=                      1,2                   
Central.Epping                               1:both 2:both                                     =BB=                      1,2                   
Central.Wanstead                             1:left 2:left                                     W==E                      1,2                   
Central.Redbridge                            1:left 2:left                                     W==E                      1,2                   
Central.Gants Hill                           1:left 2:left                                     W==E                      1,2                   
Central.Newbury Park                         1:right 2:right                                   =WE=                      1,2                   
Central.Barkingside                          1:right 2:right                                   =WE=                      1,2                   
Central.Fairlop                              1:right 2:right                                   =WE=                      1,2                   
Central.Hainault                             1:right 2:both 3:left                             =SB==N                    1,2,3                 
Central.Grange Hill                          2:right 1:right                                   =WE=                      2,1                   
Central.Chigwell                             2:right 1:right                                   =WE=                      2,1                   

This would, obvously, be better as a JSON object, but it’s just some plain text for now for debugging.




Hi Briantist!

This is awesome stuff that you’ve done, and honestly beyond the call of duty. I was going through a few of the stations that I frequently pass through, I can see that some of the opening sides are different from scraped data.

Take Hammersmith station on the East&Westbound District line for example:- the data set says that the doors for both directions open on the left, and this is not the case.
I looked at the layout code, and I think it’s been incorrectly translated- W==we==E indicates to me that the “W” for Westbound opens its doors on the right hand side, and the “E” opens on the right hand side.

From the couple of stations I’ve cross-checked, it looks like the opening sides are the other way round. Are you using a switch-case to translate the station layout to the opening side? Would it be easy to update the translation?





I’ve looked at the “which side is it” code and realised I have forgotten that the top of the page (up, if you like) is “north” on most of the original diagrams, but on the District, it’s West! I’ve updated the JSON and code to reflect this.

My debug code says this now looks right

There had to be a bit of messing around with the data to “fix” things. So I ended up with two functions that did it, so there’s this one to work out which is “north” and “south” for each diagram…

    private static function defineThisLineNorthAndSouth($strLineName, &$N, &$S)
    $N = "N";
    $S = "S";
    if ($strLineName == "Jubilee" or $strLineName == "District") {
        $N = "E";
        $S = "W";
    if ($strLineName == "Piccadilly" or $strLineName == "Central" or $strLineName == "District") {
        $N = "W";
        $S = "E";
    if ($strLineName == "DLR") {
        $N = "U";
        $S = "D";
    if ($strLineName == "Circle") {
        $N = "O";
        $S = "I";

Then correct the source codes for some stations…

    private function overrideLayoutByName($strName, $strLayoutCode, $strLineName)
    switch ($strName) {
        case "Greenford":
            $strLayoutCode = "[W1=2t2=3E ns]";
        case "Hainault":
            $strLayoutCode = "[=SB==N]";
        case "Stratford International":
            $strLayoutCode = "[=TT=]";
        case "Sudbury Town":
            $strLayoutCode = "[OP]";
        case "Turnpike Lane":
            $strLayoutCode = "[CP]";
        case "Pudding Mill Lane":
            $strLayoutCode = "[IPX]";
         *   These fixes are to deal with duplicates in the original data.
        case "Woodford":
            $strLayoutCode = "[V=WE=]";
        case "Kennington":
            $strLayoutCode = "[N1==3NS4==2S]";
        case "Croxley":
            $strLayoutCode = "[OP]";
        case "Seven Sisters";
            $strLayoutCode = "[N==N/=S+2]";
        case "Paddington":
            if ($strLineName == "Circle") {
                $strLayoutCode = "[E16==15W/=2OI1=]";
        case "Canning Town":
            if ($strLineName == "DLR") {
                $strLayoutCode = "[U4=3D/e6=5wB2=1D]";
        case "Stratford":
            if ($strLineName == "DLR") {
                $strLayoutCode = "['4a'T=='4b'T =16UD17=]";
        case "Acton Town":
            if ($strLineName == "District") {
                $strLayoutCode = "[W=WE=E]";
        case "West India Quay":
            $strLayoutCode = "[U==UD= D X+1]";
        case "Holborn":
            if ($strLineName == "Piccadilly") {
                $strLayoutCode = "[=3Wb5==4E]";
        case "Latimer Road":
        case "Goldhawk Road":
            if ($strLineName == "HammersmithAndCity") {
                $strLayoutCode = "[OP]";
        case "Chalfont & Latimer":
            $strLayoutCode = "[=NS=V]";
        case "Custom House":
            $strLayoutCode = "[=4UD3=]";
        case "Poplar DLR":
            $strLayoutCode = "[U==UD==D X]";
        case "Clapham Junction":
            /* Overground platforms... */
            $strLayoutCode = "[T==T ]";
        case "Camden Town":
            $strLayoutCode = "[N1=-=3N/S2=-=4S] ";
        case "Borough":
            $strLayoutCode = "[=S =N]";
        case "Finchley Central":
            $strLayoutCode = "[V==NS=]";
        case "East Finchley":
            $strLayoutCode = "[N=NS=S]";
        case "Mill Hill East":
            $strLayoutCode = "[T=]";
        case "Euston":
            if ($strLineName == "Northern") {
                $strLayoutCode = "[N==ns==S +2]";
         *   These need the # # that show defunct platforms near the district line
        case "Bromley-by-Bow":
        case "Upton Park":
            if ($strLineName == "HammersmithAndCity") {
                $strLayoutCode = "[=NS=]";
            } else {
                $strLayoutCode = "[OP]";
        case "Plaistow":
            if ($strLineName == "HammersmithAndCity") {
                $strLayoutCode = "=1NS2=3V";
            } else {
                $strLayoutCode = "[=1WE2=3V]";
        case "Uxbridge":
            $strLayoutCode = "[T1=2T2=3T]";
         *  Fix odd mistatakes
        case "Arnos Grove":
            $strLayoutCode = "[W1=2B3=4E]";
        case "Cockfosters":
            $strLayoutCode = "[V1=2V3=4V]";
        case "Loughton":
            $strLayoutCode = "[W==B==E]";
        case "Norwood Junction":
            $strLayoutCode = "[=N==ns==SS=]";
        case "New Cross":
            $strLayoutCode = "[b==bb=='D'V]";
        case "Baker Street":
            if ($strLineName == "HammersmithAndCity") {
                $strLayoutCode = "=6WE5=/v1==2ns3==4v";
        case "Upminster":
            $strLayoutCode = "[t==we==WE==Ev=]";
    return $strLayoutCode;

And then I needed to deal with “only readable by a human, acutally” codes…

    private static function manualDecodeOfSpeailCodesFound(&$strCode, &$arrPlaforms, $strCodeOriginal)
    if (self::hasASingleQuote($strCode)) {
        switch ($strCodeOriginal) {
            case "[v'4a'='4b'v '3a'=W3=5wE6=8ew=10":
                $strCode = "v==v =W==wE==ew=";
                $arrPlaforms = ["4a","4b","3a",3,5,6,8,10];
            case "[V'4a'='4b'V '3a'=w3=5we6=8ew=10":
                $strCode = "V==V =w==we==ew=";
                $arrPlaforms = ["4a","4b","3a",3,5,6,8,10];

            case "['4a'T=='4b'T =16UD17=]";
                $strCode = "T==T/=UD=";
                $arrPlaforms = ["4a","4b",16,17];

            case "[b==bb=='D'V]":
                $strCode = "wew==be==V";
                $arrPlaforms = ["A","B","C","D"];
    } else {
        switch ($strCodeOriginal) {

            case "[=#du#= V15=TT13=]":
                $strCode = "V==VV=";
                $arrPlaforms = [13,14,15];
            case "[...=14vW=E]":
                $strCode = "W==E";
                $arrPlaforms = [15,16];
            case "[=6we5==1V1=NS=4V]":
                $strCode = "=oi=/V==NS==V";
                $arrPlaforms = [6,5,1,2,3,4];
            case "[t4=sn=1t =5OI6=]":
                $strCode = "=OI=/v==ns==v";
                $arrPlaforms = [6,5,1,2,3,4];
            case "[N1=-=3n/S2=-=4s]":
                $strCode = "N==N/S==S";
                $arrPlaforms = [1,3,2,4];

            case "[=6we5=-=1V1=NS=4V]":
                $strCode = "=we=/V==NS==V";
                $arrPlaforms = [6,5,1,2,3,4];

            case "[=6V =4VV=WE1=]":
                $strCode = "=WE=/V==Vv==v";
                $arrPlaforms = [6,5,1,2,3,4];

            case "[=WE=WE= X]":

                $strCode = "=WE==we=";
                $arrPlaforms = [1,2,4,4];


This has been quite … fun.

And then there is Greenford, the only place on the whole system that has a bay platform where both sides are the same number (2).


The east, west malarky was an easy mistake to make! I’m working on simplifying the JSON (as shown below) and eventually build on this with a queryable API.

"lines": [
    "hammersmithandcity", [
        {"station":"Hammersmith", "northbound":"left", "southbound":"right"},
        {"station":"Goldhawk Road", "northbound":"left", "southbound":"left"},
        {"station":"Shepherd's Bush Market", "northbound":"left", "southbound":"left"},
        {"station":"Wood Lane", "northbound":"left", "southbound":"left"},
        {"station":"Latimer Road", "northbound":"left", "southbound":"left"},
        {"station":"Ladbrooke Grove", "northbound":"left", "southbound":"left"},
        {"station":"Westbourne Park", "northbound":"left", "southbound":"left"},
        {"station":"Royal Oak", "northbound":"right", "southbound":"right"}
    "district", [
        {"station":"Hammersmith", "eastbound":"left", "westbound":"left"},
        {"station":"Baron's Court", "eastbound":"left", "westbound":"left"},
        {"station":"Earl's Court", "eastbound":"right", "westbound":"right"},
        {"station":"Gloucester Road", "eastbound":"right", "westbound":"right"}

I’ll PM you with a few more ideas I have for the data :slight_smile:



The main reason I left the platform numbers in the data-set, was that there are some “famous” issues with the London Underground and compass. For example, to travel between King’s Cross and Euston on the tube…


That journey on the Victoria Line is marked “southbound”, and on the Northern line it’s “northbound”. One can start at Platform 4 at King’s Cross underground, travel one stop “southbound” to Euston, change to platform 6 and one stop “southbound” is back at King’s Cross platform 8.

Similar things also happen with the various loops at Heathrow, the Central Line’s Essex loops and the Kenngton Loop. The Camden Town junction, where the two northern branches intertwine and then split to form the City and West End branches, is another issue for clear descriptiveness.

This aside, anything that can be added to the APIs to help London’s people and visitors is always a plus.