I'm not familiar with the exact project, and I think I can answer your specific question from design/code review perspective.
Why are they needed? Who want to route via an historic non existing
railway?
I think we need to focus on the source of the routes.
The graphhopper project ex-ante uses all routes in the OpenStreetMap data-source. This project appears to contain all types of routes. That means that ex-ante all routes are valid; highway / ferry / railroad.
It is then parsed down when building the map. You can see this in the function, acceptWay, you mentioned. Here various tags are required or restricted.
Note the first few lines: We have already required the highway tag. (Or handled the other cases).
String highwayValue = way.getTag("highway");
if (highwayValue == null)
{
if (way.hasTag("route", ferries))
{
String motorcarTag = way.getTag("motorcar");
if (motorcarTag == null)
motorcarTag = way.getTag("motor_vehicle");
if (motorcarTag == null && !way.hasTag("foot") && !way.hasTag("bicycle") || "yes".equals(motorcarTag))
return acceptBit | ferryBit;
}
return 0;
}
Once we pass the main highway tag check, other checks are performed. The railway check is one of those checks.
Now: Why would we want to allow those other sub-types of railways?
Because, those types of railways might be currently passable.
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");
Further Support: Apart from tram, all those words connote some form of current non-existence.
Sometimes, the map/route will contain old markings.
So, my educated guess would be that the designers of the program, made a tradeoff.
If an acceptedRailways
is a highway and meets all the criteria of a valid highway, then allow it. Else, it will fail like any other.
(It can also be looked at as a loosening on the restrictions of the no railway tag check; where the designers were not willing to take the risk allowing a route with the railway tag, that does not have a special, non-existent like, tag. Even though it may have highway tag!)