Artarmon is in the (Gordon/Chatswood) fare group, so a weekly from Artarmon to Town Hall is $35. http://www.opalornot.com 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:
$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.
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.
Fudge distance length for trips to/from Town Hall per issue #2
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: http://www.shittytrains.info/tickets/pdf/Passenger_Fares_Handbook.pdf
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.)
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)
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.
The example HTTP server (opaldisthttp) would be easiest. I haven't really done and cross-language library stuff myself.
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. =/
@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.