Incorrect train fares for City destinations #2

dsymonds opened this Issue Feb 24, 2014 · 14 comments


None yet

7 participants


Artarmon is in the (Gordon/Chatswood) fare group, so a weekly from Artarmon to Town Hall is $35. shows it as $28.


Another case: Mortdale to Town Hall is reported as $35, but is actually $42.


One more: Ashfield to Town Hall is quoted as:
$26.40 opal
$28.00 train weekly

whereas, Sydney Transport fare calculator says the weekly ticket cost $35.00 and I pay $4.10 each way peak with Opal, so lets say $32.80 per week (though I actually get a fair number of off-peak discounts per week).


Artarmon-Town Hall: Google reports 9.2 km (zone 1), Sydney Trains 11.5 km (zone 2), diff 2.3 km.
Mortdale-Town Hall: Google 18.5 km (zone 2), Sydney Trains 20.3km (zone 3), diff 1.8 km.
Ashfield-Town Hall: Google 9.6 km (zone 1), Sydney Trains 11.6 km (zone 2), diff 2.0 km.

So looks like Sydney Trains is arbitrarily adding ~2 km to all fares to the city! Will adjust calculator to do the same.

@jpatokal jpatokal closed this Feb 24, 2014

Digging into this a bit deeper, it looks like Sydney Trains applies a reality distortion field to Town Hall!

Artarmon-Wynyard: Google 8.4 km, Sydney Trains 8.3 km
Wynyard-Town Hall: Google 0.9 km, Sydney Trains 3.1 km
Artarmon-Town Hall: Google 9.2 km, Sydney Trains 11.5 km

Mortdale-Central: Google 17.5 km, Sydney Trains 17.1 km
Central-Town Hall: Google 1.6 km, Sydney Trains 3.2 km
Mortdale-Town Hall: Google 18.5 km, Sydney Trains 20.3 km

So I'll apply the 2 km bonus to Town Hall only. WTF.


If you have a look at the "CityRail Passenger Fares Handbook" it contains the following clauses which help explain this:
d. ... the distance fare between any City Railway station ... will be for the distance of 3.21km.
e. ... the distance fare between any station outside the City Railway to any City Railway station, will be the distance to the designated gateway station plus 3.21km.
f. ... the distance fare between two stations outside the city railway when travel is through the City Railway, will be the total distances to the two designated gateway stations plus 3.21km.

You can read a copy and example here:

@jpatokal jpatokal reopened this Feb 24, 2014

Brilliant, thank you! Reopening this then until I can work out a more accurate general solution.

For reference, the 'City' stations are: Central, Town Hall, Wynyard, Circular Quay, Martin Place, Kings Cross, St. James and Museum.


Yep was just going to chime in about the passenger fares handbook too. It also gives you the official distance between stations. Which is going to be a bit of an effort to program if you want to be 100% accurate, due to the number of possible transfer points for certain trips. For example, travel from Strathfield to Chatswood - you have to consider via Macquarie Park and via the City. Or trips like Glenfield to CIty there are about four or five different routes (via East Hills, via Granville, via Liverpool/Regents Park/Stratfield, via Liverpool/Bankstown/Sydenham, etc.)

Fares are always calculated by the shortest route (not counting the distortion field around the City Railway previously discussed.)

MrTrick commented Feb 25, 2014

Another one;
Cityrail's fares from West Ryde or Meadowbank to Central are $35/wk, the same as from the Rhodes / Concord West / North Strathfield stations.
(opal_or_not currently puts them in the higher Denistone / Eastwood price bracket)

mzhou commented Feb 25, 2014

This calculates correctly according to the Ticketing Customer Handbook, but the data isn't complete yet. Only has Opal area up to 28 Februrary.



@mzhou, you're the man! That's awesome... and it's Haskell. Now I just need to figure out a way to call that from/convert it into Ruby.

mzhou commented Feb 26, 2014

The example HTTP server (opaldisthttp) would be easiest. I haven't really done and cross-language library stuff myself.

jpatokal commented Mar 4, 2014

I've now got a copy of opaldist 99% up and running on Heroku, but I need to be able to set the port it listens on (mzhou/opaldist#3) before I can start using it. =/

Soliah commented Mar 27, 2014

@mzhou, @jpatokal why not expose an JSON API from opaldist so opal_or_not can just ping it for distances?


I've got the server up and running now on Heroku's preferred post, but I still need to add in all the stations that have recently opened before I can migrate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment