Extracting Station Codes

Hi all

Codes for places are used all over the place, national rail station, airports etc. Even TfL has published it’s list of station codes.

But the new stations (Battersea and Nine Elms) have not been given the “standard” station codes by the DoT so I can’t get the code from the last three characters from the AtocCode.

Is there a “computer friendly” list of these three letter codes along with their AtocCode so I can match them up - I don’t want to have “special” case logic for these two stations.

Many thanks for you help
Steve

@Dobbo Welcome.

I’m using these codes as they fit the pattern

  • Battersea Power Station - ZPN for 940GZZBPSUST
  • Nine Elms - ZNI for 940GZZNEUGST
  • Abbey Road - BBE for 940GZZDLABR

And yes, the normal pattern for Naptan codes for underground stations (the other 213 of them) is 940GZZLUxyz where xyz is the old TfL three letter code, not three letters plus “UGST”.

@briantist Thanks for the reply.

Sorry but I’m not getting your point.

BPS is the three letter code (see link in OP) for Battersea Power Station; for Nine Elms the code is NIE; and for Abbey Road it is ABR , so why are you using ZPN, ZNI and BBE? Are these not custom codes you have created?

Not sure why you listed Abbey Road. As a stop on DLR is has the standard DLR prefix with it’s 3 letter station identifier at the end, so my looking at the last three characters of the AtcoCode would work.

The real problem code for me is 940GZZNEUGST as it doesn’t contain NIE. I am currently considering looking for the code in the last six characters of the AtcoCode, but there are bound to be multiple hits with this approach, so sorting the hit list giving priority to codes with matches at the end might be acceptable.

Just to be clear here. I am planning to first query the database when the user types three characters looking at the AtcoCode; when a fourth character is given then the query will look for matches in the stop point’s name. No point in a search before then. As far as I can see the shortest stop point names are four character (Bank & Oval).

Sorry, you’re getting confused. BPS is Blackpool South…

The underground codes are

NRE Code
Arena ZAA
Aldgate ZAD
Aldgate East ZAE
London City Airport ZAF
Arnos Grove ZAG
Pontoon Dock ZAH
West Silvertown ZAI
Arsenal ZAL
Angel ZAN
Alperton ZAP
Archway ZAR
All Saints ZAS
Acton Town ZAT
Bank ZBA
Barbican ZBB
Bow Church ZBC
Bond Street ZBD
Bermondsey ZBE
Bounds Green ZBG
Blackwall ZBH
Buckhurst Hill ZBI
Beckton Park ZBJ
Barking Underground ZBK
Bethnal Green 2 ZBL
Boston Manor ZBM
Barkingside ZBN
Burnt Oak ZBO
Belsize Park ZBP
Barons Court ZBQ
Bow Road ZBR
Baker Street ZBS
Brent Cross ZBT
Borough ZBU
Beckton ZBV
Bromley-By-Bow ZBW
Bayswater ZBY
Becontree ZBZ
Clapham South ZCA
Canning Town ZCB
Clapham Common ZCC
Colindale ZCD
Chalk Farm ZCF
Chigwell ZCG
Crossharbour ZCH
Chiswick Park ZCI
Star Lane ZCJ
Cockfosters ZCK
Colliers Wood ZCL
Chesham ZCM
Clapham North ZCN
Croxley ZCO
Canons Park ZCP
Cyprus ZCQ
Caledonian Road ZCR
Cutty Sark ZCS
Camden Town ZCT
Covent Garden ZCV
Canada Water ZCW
Chancery Lane ZCY
Canary Wharf ZCZ
Debden ZDB
Dagenham East ZDE
Dagenham Heathway ZDH
Dollis Hill ZDO
Deptford Bridge ZDP
Devons Road ZDR
East Acton ZEA
Edgware Road 2 ZEB
Ealing Common ZEC
Edgware ZED
Eastcote ZEE
East Finchley ZEF
Epping ZEG
East Ham ZEH
East India ZEI
Embankment ZEK
Elephant & Castle 2 ZEL
Edgware Road ZEM
Elm Park ZEP
Elverson Road ZER
Euston Square ZES
Earls Court ZET
Fairlop ZFA
Fulham Broadway ZFB
Finchley Central ZFC
Farringdon ZFD
Finchley Road ZFR
Gants Hill ZGA
Gallions Reach ZGC
Green Park ZGE
Golders Green ZGG
Grange Hill ZGH
Great Portland Street ZGP
Gloucester Road ZGR
Goodge Street ZGS
Goldhawk Road ZGW
Hammersmith 2 ZHA
High Barnet ZHB
Hounslow Central ZHC
Hillingdon ZHD
Hounslow East ZHE
Highgate ZHG
Hanger Lane ZHL
Hampstead ZHM
Hendon Central ZHN
Holborn ZHO
Holland Park ZHP
Heron Quays ZHQ
Holloway Road ZHR
High Street Kensington ZHS
Hainault ZHT
Hornchurch ZHU
Hounslow West ZHW
Hatton Cross ZHX
Hyde Park Corner ZHY
Hammersmith ZHZ
Ickenham ZIC
Island Gardens ZIG
West India Quay ZIQ
Kennington ZKE
King George V ZKG
Kilburn ZKI
Knightsbridge ZKN
Kilburn Park ZKP
Kingsbury ZKY
Lancaster Gate ZLA
Leicester Square ZLC
Leytonstone ZLE
Ladbroke Grove ZLG
Lambeth North ZLN
Loughton ZLO
Langdon Park ZLP
Latimer Road ZLR
Whitechapel ZLW
Leyton ZLY
Marble Arch ZMA
Mudchute ZMC
Mile End ZME
Mansion House ZMH
Mill Hill East ZML
Monument ZMM
Mornington Crescent ZMN
Morden ZMO
Moor Park ZMP
Manor House ZMR
Maida Vale ZMV
North Acton ZNA
Northwood ZND
North Ealing ZNE
Northfields ZNF
Notting Hill Gate ZNG
North Harrow ZNH
Nine Elms ZNI
Northwick Park ZNK
Neasden ZNN
Northolt ZNO
Newbury Park ZNP
Northwood Hills ZNS
Oakwood ZOA
Oxford Circus ZOC
Oval ZOV
Osterley ZOY
Putney Bridge ZPB
Piccadilly Circus ZPC
Prince Regent ZPD
Perivale ZPE
Parsons Green ZPG
Pinner ZPI
Park Royal ZPK
Poplar ZPL
Pudding Mill Lane ZPM
Battersea Power Station ZPN
Pimlico ZPO
Preston Road ZPR
Plaistow ZPS
East Putney ZPU
Queensbury ZQB
South Woodford ZQS
Queensway ZQW
Ravenscourt Park ZRA
Royal Victoria ZRB
Royal Albert ZRC
Redbridge ZRE
Ruislip Gardens ZRG
Rayners Lane ZRL
Ruislip Manor ZRM
Regents Park ZRP
Russell Square ZRS
Ruislip ZRU
Roding Valley ZRV
Royal Oak ZRY
Southgate ZSA
Shepherds Bush Market ZSB
Swiss Cottage ZSC
Sandilands ZSD
South Ealing ZSE
Stamford Brook ZSF
Stepney Green ZSG
Sudbury Hill ZSH
South Wimbledon ZSI
St Johns Wood ZSJ
South Kensington ZSK
Stockwell ZSL
Stanmore ZSM
Snaresbrook ZSN
Sloane Square ZSO
St Pauls ZSP
South Quay ZSQ
St Jamess Park ZSS
Stratford High Street ZST
Southwark ZSW
South Harrow ZSX
Sudbury Town ZSY
Tooting Bec ZTB
Tottenham Court Road ZTC
Tower Gateway ZTG
Tower Hill ZTH
Turnpike Lane ZTL
Temple ZTM
Tooting Broadway ZTO
Tufnell Park ZTP
Turnham Green ZTR
Totteridge & Whetstone ZTW
Theydon Bois ZTY
Upminster Bridge ZUB
Upminster 2 ZUM
Upton Park ZUP
Uxbridge ZUX
Upney ZUY
New Addington ZWA
White City ZWC
Wood Green ZWD
West Acton ZWE
Westferry ZWF
Willesden Green ZWG
West Finchley ZWH
Woodside Park ZWI
West Kensington ZWK
Wood Lane ZWL
Westminster ZWM
Wanstead ZWN
Woodford ZWO
Warren Street ZWS
Watford ZWT
Westbourne Park ZWU
Warwick Avenue ZWV
West Harrow ZWX
Wembley Park ZWY