Create railroad map with routing


I have downloaded all the railroads in sweden to a single .osm file (about 12 MB in size). I would like to create a map with routing and “snap to road” capability.

Using mkgmap with this command…

java -ea -jar mkgmap.jar --transparent --net --draw-priority=25 --route railroad2.osm

…will make an .img-file (~400 kB) but the gps doesn’t recognize it as a road to follow, the gps treats the railroad just as graphics on the map :frowning:

I don’t care if the gps can’t calculate estimated time of arrival (because of lack of speed data in the .osm file) but I would like it to at least recognize the railroad as a road it can follow.

Can anyone please help me?

What do you expect to accomplish with this? Assuming you can select all the railroads in JOSM and change their type to something routable, you’ll still need to make sure that all the connections between lines are routing nodes. (lots of work I expect). And when you get that the routes won’t be meaningful, because the railroads won’t necessarily follow the shortest distance or the fastest time between two points of your choosing, as would make sense in a highway network.

The reason? For my amusement and others.

As I said, the gps will not be able to calculate ETA for my journey since the map doesn’t know the max allowed speed of the track ot the max allowed speed of the train (which of course can be lower than the max speed of the track). But that is not important, when I drive the train I have the timetable to follow.

But if the track is routable the gps WILL be able to calculate the SHORTEST route (which in most cases also is the fastest). The GPS will also be able to tell me the distance to target along the track and it will be able to draw the route on the map.

The connecting nodes of the different lines ARE already connected in OSM. And since the railways will be the ONLY roads in my railway map, the shortest route WILL be along the track.

So, what do I need to do to make the railroads routable?

What’s about the JOSM plugin Routing?
You could change the highway=railway to highway=primary. And I guess it should work.

I’ll check the JOSM plugin Routing tonight. Thanks.

The railways aren’t tagged highway=railway, they are tagged railway=rail. But perhaps I can use the…

railway=rail { add highway=primary}

…in the style rules for mkgmap

Or just change the garmin type code in the style file to a routable one, e.g

railway=rail [0x01 resolution 12]