Search code examples
openstreetmapgraphhopper

Why does graphopper use some OpenStreeMap railway elements for car graph build up


The project graphhopper (Open Source Routing for OpenStreetMap) imports specific railway elements to be later used in the road network graph.

In File CarFlagEncoder.java some specific railway types, which are stored in acceptedRailways, are allowed to be added to the graph:

   // do not drive cars over railways (sometimes incorrectly mapped!)
   if (way.hasTag("railway") && !way.hasTag("railway", acceptedRailways))
        return 0;

The acceptedRailways are defined in AbstractFlagEncoder:

    acceptedRailways.add("tram");
    acceptedRailways.add("abandoned");
    acceptedRailways.add("abandoned_tram");
    acceptedRailways.add("disused");

    acceptedRailways.add("dismantled");
    acceptedRailways.add("razed");
    acceptedRailways.add("historic");
    acceptedRailways.add("obliterated");

While I can understnad why "tram" is used (cars and trams sometimes share a road, so cars can drive on it), I do not understand the other railway types.

Why are they needed? Who want to route via an historic non existing railway? as seen here http://wiki.openstreetmap.org/wiki/Demolished_Railway


Solution

  • This was introduced due to strange tagging in OSM and lead to railways used for cars, which was not acceptable.

    Now with our 'OSM market power' we are thinking to completely remove this workaround and fix the data instead. That is not only the better approach but also causes the current behaviour trouble at other places, see here for the more detailed discussion.