NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum


The recommended way to specify that a road has tram tracks embedded is to "draw a new way for the tram tracks but reuse the nodes as the street where they run completely parallel." (Tram Wiki Page)

My question now is, if I want to mark a road as 'dangerous for cycling' because it has embedded tram tracks (just an exaple) how can I get that information?

Is there any relation, or tag on the street edge that can be used to specify/know if there are tracks in it?


asked 08 Nov '13, 10:33

marcoq's gravatar image

accept rate: 0%

edited 08 Nov '13, 13:53

In the Netherlands it is common to map embedded tram tracks in a single way as the highway, and it is rendered without problems on Mapnik, see So I dont understand why this method isn't recommended in the wiki.

permanent link

answered 08 Nov '13, 18:26

ligfietser's gravatar image

accept rate: 11%

AFAIK, no official way to represent this configuration on the map.

Drawing two ways, one for the road, the other for the tram track, reusing the nodes where they overlap will trigger the "overlapping ways" validation warning in JOSM. Other mappers will be tempted to "fix" it. Also, they are two different, separate ways from the point of view of routing software.

Drawing two ways as above, but not reusing the nodes is even worse, because there will not be even the hint of the overlapping segments telling that there are two ways there, one for the trams and other for the vehicles. Software will try to "get" the nearest way from your point of view, and will select one of the two, since it is very hard to manually adjust two ways to exactly the same coordinates. Probably will trigger lots of "crossing ways" validation warnings.

Drawing one way with both the railway and highway tags set is not recommended as per the wiki page, but I could not find exactly why for the specific case of street that have the tram line embedded. I believe that the main reason is because it would be difficult for the rendering software to decide what to render (if the highway, the tram line would appear broken, else the street would). And I think, why not, since the street and the embedded tram line effectively use the same space on the ground? Also, for bus lines, there is already the "lanes:psv" (and other tags) to represent multiple types of vehicles sharing the same way.

Drawing parallel, but not overlapping ways would be right only when the tram line and the street didn't share the same physical space, i.e. no cars/pedestrians allowed over the rails and (obviously) no trams running over the street...

In short, if I had to choose, I would pick the third option, because, even if it makes things difficult for the rendering software, is the best form to allow for the fact that both share the same physical space on the ground.

permanent link

answered 08 Nov '13, 13:23

MCPicoli's gravatar image

accept rate: 24%


I agree using both the railway and highway tags seems to be the better solution, even after considering the shortcomings listed here ( Using both tags would be coherent with the way cycleways and lanes are handled: adding cycleway=lane if shared, or creating a new way with highway=cycleway if separated, and using the oneway:bicycle for conflicts. (
Anyway, yes, I understand the reasons for the discussion.

(08 Nov '13, 13:51) marcoq

Is there any tag the can be added to the street itself to mark that it has railway tracks (when the railway is on a different osm-way) without causing rendering problems? Or is this considered problematic because it adds semantic duplications?

(08 Nov '13, 14:15) marcoq

From a data processing point of view, there are several ways to attack the problem.

A relatively fool-proof way would probably be this:

  • Import your data into a spatial database (e.g. use osm2pgsql to import into PostGIS)
  • To find out whether a road is "dangerous", convert the road's linear geometry into an area (called "buffering", usually with ST_BUFFER or similar), and ask the database whether there is anything called railway=tram inside that buffer.

This would capture all the different ways of tram mapping, but it might require some refining (what if the tram is on a bridge over the street or what if it just crosses the street).

Another option is to first process all ways tagged railway=tram, split them into two-node bits ("there is a tram directly connecting node A with node B", "there is a tram directly connecting node B with node C", etc.); store that in a suitable memory structure, and when processing the roads later, simply check if any pair of two consecutive road nodes is found in your tram segment table.

permanent link

answered 09 Nov '13, 14:52

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

Thank you for the suggestions. The problem with the buffer is that when tracks are drawn individually it's difficult to understand if they are actually in shared space, or just on the side of the road ( And if I understand correctly also the second option wouldn't work in this scenario.

(11 Nov '13, 09:32) marcoq

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 08 Nov '13, 10:33

question was seen: 22,208 times

last updated: 11 Nov '13, 09:32

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum