Hacker News new | past | comments | ask | show | jobs | submit login
OpenRailRouting (github.com/geofabrik)
82 points by Stevvo 3 months ago | hide | past | favorite | 21 comments



Interesting. I talked to the founder of Graphhopper at some point. Nice product.

I'm currently traveling by local rail connections across Germany currently using the Germany ticket (49 euro/month, amazing value). This restricts me to local only connections and it's a nice way to see the country if you are willing to travel at a bit slower pace. I simply do 1-2 hour hops at the time and then get myself an airbnb look around a bit and then move on every few days.

One of my challenges is routing and mapping. Mostly I use the Deutsche Bahn tool for this where you simply enter where you want to go, restrict it to local connections, and then you get your route. There isn't much else that is usable. Google maps is alright for scheduling but you can't restrict it. And mostly it's transit layer is very incomplete.

What's missing is a good global map of all connections everywhere. Which would help me identify easy to get to destinations. Mostly, I'm just figuring out where to go by staring at a map and then figuring that there's probably some sort of rail or bus connection I can use to get from A to a potentially interesting B.


Check out https://www.xn--pnvkarte-m4a.de/ for a good global map of all connections everywhere (based on OSM data)


I heard the German rail network suffers from frequent delays from chronic under-investment. Have you found it to be the case?


"In 2023, less than two-thirds of long-distance trains reached their destination on time –– a new record low."

https://www.msn.com/en-xl/news/other/major-construction-begi...

https://db-engineering-consulting.com/en/news/riedbahn-renew...


Delays are a problem. Much easier to deal with when you are not in a hurry, though. Mostly we're talking about 10-20 minutes here. So, not too bad.


Fun to see someone productionize this - I've done this for years to get segments between two stations to accurately be able to render individual train services. I'll let you know that at least on national rail provider in Europe used those results for a long time...


One thing I’ve been curious about but have never dug into deeply enough to understand is what constitutes an “address” on a cargo line.

As an example, in the US, large lumberyards often sit on a rail line to receive deliveries. Often that lumber comes a long way… for instance from the Pacific Northwest to the east coast.

Maybe if I look at this project a bit I’ll understand how you slap a “To:” address on such a rail car.


The Federal Rail Administration assigns every section of track etc. a number called FRANODEID. If you took US rail network data from FRA/BTS and adapted this tool to use it, then you could route that can from any line in any yard to any other. I think these numbers are the 6 digit numbers in the waybill posted in the other comment.


In the example I posted, in the F9 and D9 lines, the first number is the FSAC (freight station accounting code), the second number is the SPLC (standard point location code - different from what you're referring to), and the last number is a Canadian-style postal code.


Since it looks like you're talking about North American freight rail, here's an example rail shipment waybill (taken from the CN implementation guide which I found online [1])

  ISA*00* *00* *02*CN *ZZ*GENERIC *230710*1339* U*00803*006298413*0*P*>
  GS*WB*CN*GENERIC*20230710*1336*98826*X*008030
  ST*417*988260001
  BX*00*R*PP*1257*CN*L*B*N****N
  BNX*R**S
  N9*BM*1257**20230710*1336
  DTM*168*20230710*1336*ET
  N7*CN*123456*213360*N*66700******RR****6711*M*****186*128***C214
  M7*12345
  N8*111111*20230710
  F9*070112*WATSON*SK*****071511*S0K4V0
  D9*093390*VANCOUVER*BC*****0093900*V5T1E1
  N1*SH*GENERIC CARLOAD INC*C5*1111111111111
  N3*123 FIRST ROAD
  N4*WATSON*SK*S0K 4V0*CA
  PER*IC*CONTACT NAME*TE*123-123-1234
  N1*CN*GENERIC CONSIGNEE CO*C5*2222222222222
  N3*12 SMITH STREET
  N4*VANCOUVER*BC*V5K 1P7*CA
  N1*PF*GENERIC CARLOAD INC*C5*1111111111111
  N3*123 FIRST ROAD
  N4*WATSON*SK*S0K 4V0*CA
  R2*CN*S****R
  LX*1
  L5*1*WALLBOARD*3275440*T
  L0*1***213360*N***1*CLD
  MEA*AI*VOL*250.6041*CR***15
  MEA**VWT*0.7167*KC***15
  SE*31*988260001
  GE*1*98826
  IEA*1*006298413
The F9 and D9 lines are the origin and destination stations, respectively. WATSON, SK and VANCOUVER, BC are regulated names and can be used to find actual station coordinates in an industry reference file. These are the start and end points of the shipment from a rail network perspective.

There's also a pre-baked route. In this example the route is just "R2*CN*S**R" which basically means the rail cars are never leaving CN (since it's a giant class 1 railroad and this is their example). But in your example of a cross country shipment, the route might look something like:

  R2*BNSF*S*CHGO
  R2*UP*1*PITTS
  R2*NS*2*PHILA
  R2*CSXT*D
In this example, the first name is the carrier for that leg, the second value is the role that carrier plays (S = shipper's carrier, 1 = first intermediate carrier, 2 = second intermediate carrier, D = delivery switch carrier), and the last name, if present, is the junction station where the two adjacent carriers will meet. Like the station city+state names before, these junction abbreviations are regulated and can be looked up in industry reference files to find more information. But assume that BNSF and UP are well aware of how they interchange at CHGO.

Of course the shipment probably came from some factory and is going to some other factory. Those addresses can be found in the N1*SH (shipper) and N1*CN (consignee) blocks. Obviously the railroad isn't going to drop a group of rail cars at the consignee's street address, but the "delivery switch carrier" railroad in charge of handling that last mile service will have an existing relationship with the consignee and know where to take the cars. They'll often have pre-arranged schedules for when a locomotive will arrive to bring new loads and pull away empties.

[1] https://www.cn.ca/-/media/files/customer-centre/customer-cen...


How does this routing model compare to the transit options of Mapbox's and Google's API? Are there other models out there to trace train routes?


Not at all. This appears to be an actual router for rail, not a router for public transport by train. That is, if you happen to own a nice locomotive, and miraculously have unimpeded direct access to all railways, then this tool will be a useful planner.

For all of us poor folk lacking trains and quite seriously high level political influence, this is a theoretical routing tool for planning possible rail routes. Hence the support of its development by the SNCF.


> That is, if you happen to own a nice locomotive, and miraculously have unimpeded direct access to all railways, then this tool will be a useful planner.

By law, that already is the case across Europe - all you need is a commercial entity, a locomotive (or multiple) that support all the voltages and signalling/trackside security systems used on the route, carriages that are certified (freight cars usually are Europe-wide, passenger cars run under RIC) and operators that have "Streckenkunde" (=they know where signals, switches, street passes etc. are on a route).

There are a handful of people doing just that, in Germany Roland Sandkuhl / LokRapid has gotten incredibly famous after a TV show featuring him and his old-timer Class 219 locomotive has gone viral [1].

[1] https://www.ndr.de/fernsehen/sendungen/hallo_niedersachsen/R...


> There are a handful of people doing just that, in Germany Roland Sandkuhl / LokRapid has gotten incredibly famous after a TV show featuring him and his old-timer Class 219 locomotive has gone viral [1].

Mind that in a legal sense he operates no EVU (Eisenbahnverkehrsunternehmen / railway operation company) but a locomotive rental business where he lends his locomotive including engineer (himself) to EVUs.

But small EVUs exist(-ed), like Rail 4U / Barbara Pirch with her E 94 locomotive, which unfortunately had an accident.


Don’t you also need to negotiate timetable slots?


Nowadays you can "negotiate" relatively easily ad hoc on a website these days. Assuming there is free capacity. On "bug" cargo routes that typically works few hours advanced.

https://www.dbinfrago.com/web/schienennetz/leistungen/trasse...


If there is capacity, they are obliged to provide it on a non-discriminatory basis. If there isn't capacity, then it gets into questions of allocation (which still needs to be done in a fair and documented basis).


There's also a lot of other use cases! For example, if you have a train schedule with stations and times, you often aren't told how the train will navigate between those stations. In some countries it's straightforward but for instance SNCF TGV services in France sometimes go hours without stopping at a station, crossing a lot of distance. In that case a solution like this can help you find an educated best guess to show users on a map.


Reading your comment I also realized that something like this would also be quite useful in the eventuality of a grand war in Eastern Europe (let’s say) and of the sudden necessity that would arise at that point of sending big and heavy stuff (ordnance, tanks etc) by train from one part of the continent to the other. Even though I do hope that the European militaries already have this type of policies in place (and hopefully handling connections between several countries’ rail-systems).


This doesn’t appear to do routing across railway services, but rather on the tracks. It has no idea whether there is an actual train that runs on the offered route, only that there is continuous track from A to B without gauge changes etc.

Put another way: You would use this to plan a route for a train service you were thinking of operating, not for trying to find services that already exist.


GraphHopper supports time-dependent public transit routing by itself. You need the timetable information (GTFS) and maybe also a real-time data connection. From this data also other providers like Google and Mapbox offer their transit options, I think.

The OpenRailRouting project however is more for planning purposes (i.e. for the railway companies) to determine how long a train will take from A to B and which exact rails the route will take and which turns are allowed and more.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: