Railway usage tagging

At the moment in Sweden, the railways tagged as usage=main are based on the EU TEN-T core and comprehensive networks. I think that it would be better to use something different for this tagging, as the EU designation sets the boundary quite high for being included, so many railways that are important nationally or regionally are not included and are thus tagged as usage=branch.

@leojth suggested to me that the Trafikverket track types (bantyper) could be used instead. There are 8 categories of railways. The NJDB map viewer shows the track types (select ‘statligt järnvägsnät’ then ‘bantyp’).

I suggest using track types 2 (Tracks forming major continuous corridors) and 3 (Lines comprising major freight routes with significant passenger traffic) as usage=main, along with track type 1 (Railways in metropolitan areas), where it connects to those.

This would mean that quite a few railway lines are upgraded to usage=main, but also that a few are downgraded to usage=branch. There is also the case of Inlandsbanan, which is not included in the classification system as it is not run by Trafikverket. I am unsure if it should be usage=main due to its length, but this can be discussed.

Currently in Sweden, a lot fewer railway lines are tagged as main lines than in most other countries. If you look at OpenRailwayMap, you can see that hardly any of Sweden’s railways are visible at larger zoom levels.This proposal would mean that Sweden is brought more in line with international tagging standards and that data consumers would have better data on which lines in Sweden are important.

Please give me your thoughts!

I’m a major mapper of a vast number of railways in the USA, and contributor to our national wiki page United States/Railroads - OpenStreetMap Wiki and many state-level railroad wiki pages, especially those in California (California/Railroads - OpenStreetMap Wiki : we’ve had to break them out into several sub-wikis, they got so large and detailed). I’ve also collaborated with a number of other OSM Contributors who know more about rail networks and wrote how usage=* tags might be best used on USA rail in OSM in OpenRailwayMap/Tagging in North America - OpenStreetMap Wiki .

What I see you asking about is correcting Sweden’s rail networks in OSM to more-harmoniously correspond to both your “8 categories” AND the generally-accepted usages of the usage=* tag using OpenRailwayMap’s (ORM’s) conventions for this tag. There is a “sweet spot” for Sweden (and all countries’ rail in OSM, really) to achieve here and it seems that with the “core and comprehensive networks” as well as the Trafikverket (banterer), “somewhere in the middle” seems correct. Without fully understanding the implications of what you specifically are proposing for how track types 1, 2 and 3 are “upgraded to main,” it does seem to me like you are (heh, pun intended!) “on the right track” to good usage of usage=*.

That “sweet spot” of both achieving how any particular national rail network is comprehensively mapped (for example, for someone who is professionally familiar with the network) as well as how anyone ALSO familiar with ORM would “see” the networks is the correct place to aim. You might need to “tweak a bit up or down” after you complete this, but such “draft mapping” (a first draft might be the correct one, or you might need a second draft to get it “perfect”) is OK: OSM is a project where incremental improvement is not only OK, it is encouraged, as it allows visualization, community discussion and public availability of mapping editors (I recommend JOSM, as its relation editor for route=railway relations is excellent; don’t forget to use the Sort button) of multiple human editors to agree to make corrections.

(BTW, “shouldn’t be usage=main because of its length” for short segments is a valid concern, but do be assured that fairly short segments can be considered usage=main if they really are usage=main: they have heavy traffic, they are exceedingly important for connectivity reasons, etc.)

Good luck in achieving this consensus and your “sweet spot” for rail mapping in OSM in Sweden!

1 Like

I see that a lot of people have viewed this post, but no one is commenting. Please write something! I do not feel able to do what I am suggesting without some discussion.

Do we know what the main/branch tag is based on in other European countries? Are these also based on the EU TEN-T?

If they are, maybe the tagging in Sweden is correct after all? And if they are not, what are the main/branch tagging based on in other european countries?

There are after all not as many railways in Sweden as in, say, Germany. But is the percentage of “main” railways in Sweden higher or lower than Germany?

I looked on the OpenRailwayMap country tagging pages to see what they said on this. The pages for Germany, Austria, and the Netherlands said they follow their national classifications, while the Czech page just gave general advice. The others do not cover it. There is no mention of TEN-T anywhere on the wiki. From comparing the TEN-T online map with OSM, I don’t see any other countries that exactly follow it, although some are quite similar.

I would say that it is expected for Sweden to have a higher percentage of main lines than other countries due to the history of closures. The railway network decreased from 16,900 km in 1938 to 10,900 km today, and most of the lines that closed were the shorter local lines that would be tagged as usage=branch. So what remains today are more likely to be the longer lines that serve larger settlements which I would argue should be tagged as usage=main.

If they follow national classifications, then so could we in sweden as well :slight_smile:


I totally agree on that more railways in Sweden should be tagged as main. I didn’t know that the current selection was based on the TEN-T networks, but a wider definition is needed. If we should use a specific definition, The NJDB category “bantyp” is useful. But if it should be used, I would rather also include category 4 (Lines with daily travel and commuting). If not included, some important lines would still be tagged as branch, as the line between Östersund and Storlien (connecting with Norway), Södertälje-Eskilstuna-Arboga, Järna-Nyköping-Norrköping, and others. Another source/definition could be Trafikverket’s page on the railway network (Sveriges järnvägsnät - www.trafikverket.se), and tag all the named railways as “main”, and those marked as others (Övriga banor) as “branch”. Or we could just have a case by case discussion on which railway lines that are important enough to be tagged as main.

Again, “you are on the right track” as you do this. It might take an iteration or two (or three) and some time (months, a year, even two years…) but as you do this, and more people look, and heads begin to nod, and the small disagreements turn into “well, we only need to tweak this extra little bit here, and then we’re all done and everybody is in agreement” and presto: OSM (or ORM) strikes again!

It’s pretty cool to have a “plastic” map that turns into a bunch of people all nodding our heads with wide agreement. It might take a little bit of discussion and some minor “what about this?” (or that), but afterwards, Yeah!

When I was first thinking about this I was really stuck on whether to include bantyp 4. I eventually chose not to because there is such a wide variety of lines in that category so including it would mean only lightly trafficked freight lines would be left to be tagged as usage=branch. At the moment there isn’t enough usage=main so I don’t want to create the opposite problem of there being too much! I may be wrong though. @stevea do you think this would be a problem?

You are right though that there are some lines in that category that are definitely important enough to be included. The definition given for bantyp 4 highlights that there are a broad range of different lines included: “This type of line consists of sections ranging from extensive regional train services to lines with fewer regional train services and some freight services.” So maybe the best thing would be to have a discussion on each of these lines, as you suggested. Although, I wouldn’t expect many replies to that given the limited activity on this post. Alternatively, we could set some kind of definition for inclusion such as number of trains per day, or maybe something else?

I don’t think we should use that Trafikverket webpage as it includes pretty much everything that isn’t a very minor line, including some that are bantyp 5.

Well, I’ll say it one more time: as long as many of you who are all or some of a combination of “OSM” and “in Sweden” and “at least a bit familiar with the nation’s rail” and the dialog is happening…you are “on the right track.”

Throw a dart at the dartboard. Don’t be shy to be the one who goes first (at “realigning” the nation’s rail, perhaps using ORM as a visualization tool), as minor “mistakes” are easily corrected within a day or two…this might mean that not enough people are included in the conversation. Or, perhaps, they are included, but there remain some (usually minor) disagreements. Go through a “second iteration” (with some minor corrections that fall into a bit of dispute, again, this is OK) and even a third or more. Keep tightening it up to the point where everybody is nodding heads and agrees the right balance of “usage=main” and “usage=branch” has been achieved.

It might take a few weeks or even a few months, but OSM works like this, and works pretty well when there is a good renderer (like OpenRailwayMap) as you change the tags. It takes a day or so for ORM to render, so you’ll get decent turnaround. Sometimes it’s a discussion, sometimes you actually have to “see it in the map,” but eventually, heads are nodding. The whole process is pretty cool, actually.

The reason I’m not answering specifics about Sweden’s rail is because I sincerely don’t know. What I DO know is how these “conversations in the map, using ORM to render” actually do work (from my efforts in the USA, with other railway mappers here) and eventually, we got our heads nodding, too. It can be done, it is pretty neat when it works! What does it take to “make it work?” Everybody talking to one another. After that, it’s easy.

It seems as we agree on that at least category 1-3 should be tagged as main. I think that’s a good start. But I definitely think that category 4 lines that are already tagged as main should remain so. These include:

  • Boden-Kalix-Haparanda
  • Bräcke-Östersund-Storlien
  • Järna-Nyköping-Norrköping

And I also think that the Södertälje-Eskilstuna-Arboga line (Svealandsbanan) should be tagged as main as well. That’s an important line of modern standards connecting several cities around lake Mälaren (electrified, partly double track, and an operating speed of 200 km/h).

As for the others… I also think that the line to Mora, and the line Linköping-Kalmar are main railways as well (but of course of less importance than others). And Inlandsbanan, that’s a 1200 kilometer railway line - is that a “branch” line?!? As of now, you can’t see the whole of that line on the map at the same time, since it disappears when zooming out. Perhaps it would be good to have more tagging options to further differentiate the usage/importance of railways.

1 Like

Please don’t take this the wrong way, as I most certainly not “an ultimate consultant” on what any particularly correct methodology would be to do this. (Though I have offered my perspective and been asked about it, so I’ll consider my opinions welcome, and am comfortable continuing). Exactly where these “Sweden’s regional / national rail edges” meet and blend with “ORM’s tagging practices” can be a bit of a country-specific task, but not too much, hopefully, without too many exceptions.

@kildor’s response above is a delightful reply, exactly in line with what I’ll call “Goldilocks” (a children’s fairy tale where neither too big nor too small a size is correct, but rather “just right” sized). A good, short, bullet-item list, some qualifications like speed, a question or three, an observation or two that things might not be ideal with tagging, but that this can be improved with discussion. Excellent! And, noticing that categories 1-3 are a good start (for usage=main) and that 4 is somewhat flexible, at least for now, at least for routes already tagged usage=main. Succinct, sweet. Very nice!

I feel like I can waltz away from this topic knowing it’s in good hands as you folks discuss like this. It looks as if you’ve put together some great dialog here, that’s neat to see. Enjoy mapping Sweden’s rail in OSM and ORM, this can be a lot of fun and when it is “modeled well” it can be quite useful for many endeavors, including building and strengthen both OSM and rail enthusiast communities. (Yes, I did play with model trains as a boy…designing more complex switching and yard extensions was great fun).

Do consider the longer-term of how you want to ultimately “structure” rail, too. Germany (and other parts of Europe?) tend to use a three-relation hierarchy (including route=tracks, route=railway, route=train), whereas in North America we skip using route=tracks, gathering into two relations only: infrastructure into route=railway relations (supporting freight rail) and route=train relations for passenger rail. (In the USA, we don’t find any particular benefit to using route=tracks relations. so we don’t, and so far after a decade of doing this, our rail data in OSM seem to be fine with renderers like ORM and routers). We also have a number of statewide wikis that document certain kinds of OSM tagging progress and grouping / structuring of these relations together (sometimes into usage=main vs. usage=branch tables), but that’s not required, more like “what we’ve done, and it works, and it helps, so we keep doing it.” For example, California is building a high-speed rail and our wiki “tracks” its progress in the map and the real world. Sometimes the wiki will drift a bit from the map or vice versa, but not too much, really. And our Amtrak wiki (USA’s national passenger rail, Amtrak - OpenStreetMap Wiki) gets updated by a number of editors, so it’s usually quite up-to-date. Breaking this down from national-level rail to statewide probably isn’t helpful except for the largest countries (with lots of rail), so whatever is “scope appropriate” in Sweden should work: you can go as wide or local as you deem appropriate.

If it is usage=branch, tag it as such. Please don’t tag it with something additional because you’d like to see it rendered in ORM a certain way: this most definitely would be “tagging for the renderer,” and OSM discourages us to do that.

I find that (in California, where I do a major portion of my railway mapping in OSM/ORM) the “tunings” that ORM uses to display usage=branch are not quite as I would like them (I think displaying these “yellow lines” one or maybe two more zoom-levels wider would be nice), but that’s too bad for me. Evidently, the “tunings” are made for Germany (and environs), what appears to be the “densest” rail network on Earth, and the authors of ORM are German. So, the “feedback loop” of ORM (having origins from OSM tagging on rail) work quite well for Germany, and “pretty well” (though maybe not quite “perfectly” or to everybody’s liking) everywhere else. That’s OK: what matters is the tagging in OSM, not the rendering in ORM.

Additionally, there are “notes to self” that can be kept in OSM’s tagging convention, like a note=* or a description=* tag. In the USA, we append “MT 1” or “MT 2” to denote a Main Track 1 or 2 in the name=* tag. That’s not a perfect use of tags, but it’s lightweight enough of a fudge that it allows multiple human editors to buffer edits a bit as we sort out the finer details of naming and categorization. Some convention you (Sweden-based OSM rail mappers) might work out to do this to mean certain things might very well evolve and be something you find useful. OSM’s good old-fashioned “plastic” tagging (and the good old note=* tag) to the rescue again.

Have fun mapping your rail network(s). It’s a neat community of people, fine-tuning, slowly improving, slowly fine-tuning, slowly improving conversation with others. And map (data) keep improving. Nice.

In the USA, we are only in earlier stages of things like junction, yard, signal, milepost, maxspeed and many other kinds of rail mapping in OSM, but people know how to read (wiki, largely) and talk to one another, so it sort of self-regulates itself with “people talking to one another and getting up to speed on the tools and tagging” and boom, it’s looking pretty good with maybe only a few or several people in maybe only a few weeks or months (or a year, whatever). Nice.

Data grow as people dialog. Rinse, repeat.

I agree with you that those three lines should remain usage=main. If they are important for the EU then they are important for OSM. Arlandabanan should also remain usage=main (it’s not included in the bantyper). I also agree with you about Svealandsbanan. I don’t think Linköping-Kalmar should be included though as it has a low speed limit, is not electrified and has passenger services only every 2 hours. I think Inlandsbanan should be usage=main simply because of its length. It seems a bit silly to say it is a branch line. That also means that the line to Mora would also be usage=main as it connects to it at its southern end.

You’re right that there should be more tagging options for railway line types. Right now there is a lot of ambiguity over how to classify usage=main and usage=branch. The tag names suggest that it should be based solely on the route geography, with long though routes being main lines and the branches off those being branch lines. However, the consensus is that you should also include other things to determine the ‘importance’ of the line, such as infrastructure standard and train service level. It’s hard to know what weight to give each of these metrics when there is no good information on the wiki.

I’m in “partial agreement” with you about “no good information on the wiki.” There are the ORM guidelines, which try to be “universal” (not country-specific) and then there are simply places where (usually fairly minor) rail tagging really must be country-specific. In my first reply in this thread, I offer three links, a national wiki, a state wiki (the most comprehensive in the USA — it is actually four, maybe soon-to-be five wikis for one state!) and the “continental wide” wiki (sorta like EU-wide, but specific to Canada, USA, México). The latter has a LOT of good work on usage=*, crafted over the last couple of years by smart, rail-industry savvy people who had a fair bit of discussion with OSM-rail and ORM people. The sections on how to determine usage=* ARE specific to North America, but you can get a good idea of how these were determined (they are largely USA-based, but also work in Canada and México). Together with some Sweden-specific perspective on your “national rail network,” you can have these similar dialogs and “best practices” to tag usage=main and usage=branch WILL emerge for Sweden. You are in an early-to-middle stage of this, that’s great. Please continue! That’s how this is done, there is no hurry, no timeframe and what the bullseye on the target is OSM calls “consensus.”

It just naturally unfolds like that, sharpening up in focus a bit more every day/week/month/year. We are being (well, I am being!) particularly chatty about it here and now, to be encouraging. You Swedes mapping rail in OSM and ORM are fine, keep going, you’re doing great.

I have started to add some information (Usage and Category) to the table at the OSM wiki page on Swedish railways: Sweden/Railways - OpenStreetMap Wiki. This will perhaps make it easier to get an overview and see which lines that are candidates for being changed to “Main”.

1 Like