javagraph

Railway network graphs


Do you know about some library of graphs (railway network graphs) on the Internet, which I can use for simulating? It don't have to be graphical, but it could. I am looking for real (almost real) graphs of railway network. Graphs should contain distances between places. I would like to use these graphs in Java SE.


Solution

  • You can use data from OpenStreetMaps. It is stored in xml format. Just download *.osm file of some region and select only railways. Railways have type "way" in xml and attributes "railway"="rail". Here is an example of such data:

    <node version="7" lon="45.9502925" lat="51.5942789" ... id="344372532"/>
    <node version="7" lon="45.9505103" lat="51.5945062" ... id="344372533"/>
    <node version="7" lon="45.950933" lat="51.594687" ... id="344372534"/> 
    
    <way version="6" changeset="6856374"visible="true" user="lamaur"uid="377142"timestamp="2011-01-03T23:42:49Z"id="34895610">
        <nd ref="919804950"/>
        <nd ref="919805175"/>
        ...
        <nd ref="409244123"/>
        <tag v="rail" k="railway"/>
        <tag v="spur" k="service"/>
    </way>
    

    upd

    Map data sepparated by regions is available at http://downloads.cloudmade.com/