Proposal:Railway Schematic Mapping

From OpenStreetMap Wiki
Jump to navigation Jump to search
Consistent Railway Mapping
Proposal status: Abandoned (inactive)
Proposed by: Mart
Tagging: railway=*
Applies to: way
Definition: Making railways more consistent with highways (and with each other)

Rendered as: Single line representing the path of one or more parallel tracks
RFC start: 2013-04-12
A double-track railway mapped as a single way, with a simple station node coupled with detailed mapping of the station building.
A double-track railway mapped as a pair of ways, with a pair of level crossing nodes where it meets a two-lane highway.
A double-track tramway mapped as a pair of ways that run alongside a four-lane highway, although in reality the two inner lanes are shared by automobiles and trams. Furthermore, the turning tracks appear to run outside of the street but in reality they are completely contained inside the intersection. Finally, on the far right is a tunnel entrance after which the two separate tracks appear to merge into one, but actually the tunnel is also double-tracked and this is just a collision of the way-per-railway and the way-per-track styles.


This is a proposal to revise and refine the existing definition of the railway=* tagging scheme to to improve consistency with the detailed mapping schemes that have been adopted (or, at least, proposed) for highway=*, and to tag railways using similar schemes than highways. It also lays a simple foundation for schematic railway mapping that could be complemented with additional tagging schemes for further levels of detail, just as has been done for highway mapping.

Currently most of the tag definitions for the various types of railway (railway=rail, railway=tram, railway=light_rail, etc) do not describe whether they represent the path of an individual pair of rails for a single train or whether they represent potentially-multiple tracks running along a single trackbed -- in other words, a "track" vs "railway", in the same sense as a lane of a highway vs. the highway itself.) Due to the lack of a defined standard for this, the mapping technique varies between areas and, in some cases, even within the same city where several mappers have collided.

Furthermore, it is common for a single highway (consisting of one or more lanes) to be encoded as a single way, and so when a railway mapped on a per-track basis interacts with a highway mapped as a single way the result is often confusing and ambiguous. For example, if a railway represented as two separate ways (one for each track) crosses a highway at a level crossing, the only option is to tag both crossings as level crossings, which may cause a routing application to apply a time penalty twice even though both tracks are controlled together.

This proposal attempts to address these problems by defining railway=* ways to be consistent with highway=* ways, to mimic highway-related proposals that allow multiple tagging detail levels to coexist without conflicting, and finally to define a more refined tagging scheme for situations where railways and highways interact, such as level crossings and shared rights of way for trams.

Within this proposal I'll use the term "schematic mapping" to refer to tagging that attempts to show the approximate relative positions of paths and the connections between them -- in other words, to show the network of highways and railways (and for that matter, waterways, etc) -- and the term "detail mapping" to refer to tagging that attempts to describe in detail the shape, size and layout of the infrastructure objects on the ground.

Schematic Mapping of Railways

The definition of the existing railway=* tag is refined to apply it to schematic mapping of multiple parallel running tracks within a single right-of-way.

The primary intent of this proposal is to make the tagging scheme in this section the baseline minimum useful tagging for railways. A renderer that considers only the tags in this section should still do a fine job of rendering a basic street map. The tags in the sections that follow, then, are completely optional progressive enhancements to this scheme that are designed to live alongside it without conflicting.

(For simplicity I've not included the ones relating to non-operational railways, but I'm not proposing that these be removed; instead, their definitions ought to change in a similar way were this proposal to be accepted.)

Key Value Element Comment Rendering Photo
railway funicular way Right-of-way for one or more parallel "tracks" of a cable-driven inclined railway. In many cases they serve touristic interest, giving easy access to spectacular mountain views. Rendering funicular.jpg
Vilnius funicular.jpg
railway light_rail way Right-of-way for one or more parallel tracks of a higher-standard tram system, separated from highways and other rights of way. Often it connects towns and thus reaches a considerable length (tens of kilometer). Pittsburgh LRT 4305 47L Gateway to Library April 2008.jpg
railway miniature way Right-of-way for one or more parallel tracks of a miniature railway. These are narrower than narrow gauge and carry passengers. They can be found in parks.
Dampfbahnfreunde sommerhofen 09180016.jpg
railway monorail way Right-of-way for one or more parallel tracks of a railway with only a single rail. A monorail can run above the rail like in Las Vegas and Disneyland or can suspend below the rail like the Wuppertal Schwebebahn (Germany)
Monorail in Kuala Lumpur
railway narrow_gauge way Right-of-way for one or more parallel tracks for narrow-gauge passenger or freight trains. Narrow gauge railways can have mainline railway service like the Rhaetian Railway in Switzerland or can be a small light industrial railway. Use gauge=* to specify the actual width of rails. Rendering narrow gauge.jpg
Narrow gauge.jpg
railway rail way Right-of-way for one or more parallel tracks for full sized passenger or freight trains in the standard gauge for the country or state. Mapping-Features-Railroad-With-Station.png LGV Est PK217.jpg
railway subway way Right-of-way for one or more parallel tracks of a city passenger rail service running mostly grade separated and often underground (see Wikipedia:rapid transit).
Madrid - Estación Marqués de Vadillo - 20060910.jpg
railway tram way Right-of-way for one or more parallel tracks for one or two carriage rail vehicles that are designed to run along rails embedded in a highway. (Other languages) Use in isolation where the tramway is separated from a street, or apply this tag alongside highway=* where a highway has at least one lane that includes rails for a tramway. Where railway=tram is used together with highway=*, the remaining tags on the way describe the highway rather than the railway, except as noted below. Praha, Hloubětín, Lehovec, tram KT8D5.JPG
railway level_crossing node A point where rails and roads cross. To be used on a single node where a railway way and a highway way cross, with the node placed at the center of the area shared by the rail right-of-way and the highway right-of-way.
Rendering-railway-level crossing-mapnik.png
Level crossing - Chertsey - England - 270404.jpg

Additional Tags for Railways

This proposal makes no change to the meaning of the additional tags described for railway=*, except as follows:

  • tracks=* may additionally be used on a way that has both railway=tram and highway=*, where it shall give the number of tracks that are embedded in the roadway.
  • service=yard is often used to show many parallel tracks used for train storage. While the definition above suggests that any number of parallel tracks may be represented by a single railway=* way, this is primarily aimed at tagging running tracks and mappers should use their best judgement in using multiple ways where it creates a more realistic impression of the breadth of the yard; for example, if tracks are separated by platforms or other infrastructure then it can be helpful to use as many ways as necessary to show the relationships with that infrastructure.

Railways crossing Highways

There are several ways for railways and highways to cross. The following table lists some examples; none of these tags are new but their definitions are refined to go with the principle of mapping the right-of-way rather than the individual tracks.

Key Value Element Comment Rendering Photo
bridge yes way If the railway goes over a street, waterway or other railway, apply this only to the segment that is raised above the ground. Use only one way per bridge, even if two tracks pass side-by-side over the bridge. If there is a pair of smaller bridges with one track each, use two separate ways and consider tagging each as tracks=1.
Railway bridge mapnick render.jpg
Railway bridge.jpg
cutting yes way A section where the railway is significantly lower than ground level. Use only one way per distinct cutting, even if two tracks run side-by-side in the cutting. If there are two separate cuttings with one track each, or if one track is in a cutting and the other is not, use two separate ways and consider tagging each as tracks=1.
Railways cutting.jpg
embankment yes way A section where the railway is raised significantly higher than ground level. Use only one way per distinct embankment, even if two tracks run side-by-side on the embankment. If there are two separate embankments with one track each, or if one track is in an embankment and the other is not, use two separate ways and consider tagging each as tracks=1. Railway embankment.jpg
tunnel yes way If the railway goes below ground, apply this only to the segment that is below the ground. Should be always present on subways. If a small number of tracks run in parallel and share the same tunnel (even if narrow walls or fences separate the tracks) then only one way is needed, but if the tracks split in two (for example, to serve both sides of a center boarding platform), use two separate ways for this section and consider tagging each as tracks=1. Haywards Heath tunnel.jpg

Trams at Intersections

Since trams often run along a highway, they must also often negotiate street intersections shared with automobiles. For the purposes of schematic mapping, if the tramway makes a turn at an intersection and continues to run along a perpendicular street, just tag both streets with railway=tram and don't try to model any trackway curves that might be present inside the intersection. The detailed two-dimensional rail mapping proposal below describes how one can show the true path of track curves, in relation to the railway or highway area they traverse.

Interaction with Route Relations

Route relations list a sequence of ways that connect to form some form of logical route. The most likely kind of route relation for railways is a public transit route, such as route=train or route=tram.

Railway ways can be included in a route=train or route=tram relation in a similar way to how highways are included in a route=bus relation, namely that the "forward" and "backward" roles can be used to show for each way whether the train moves in the direction of the way or in the opposite direction.

For tram routes, the route relation may include a mixture of both highways and railways if the tramway runs along streets for part of its route but runs along private rights of way for other parts. (For example, San Francisco's Muni Metro is a mixture of tram, light rail and subway, running along streets in some places, in separated tunnels and surface rights-of-way in other places.)

This proposal does not include a way to show specifically which tracks of a railway a given route runs on; this detail is not often important to passengers riding the rail line, and often varies depending on the service patterns of other routes sharing the same tracks. This limitation is also true for bus routes, where there is no existing tagging scheme for defining exactly which traffic lane the buses drive along.

Rationale for mapping Railways rather than Tracks

Schematic mapping is the baseline for a useful rendered streetmap and for minimal routing. The primary purpose of a street map is to show the available connections between different highways, railways, waterways and footways to help people navigate. It is valuable for the tagging of the network to be consistent between transport modes, so this proposal refines the definition of railway=* to be consistent with highway=*.

Rationale for mapping Tramways on the same ways as Highways

There has been some debate in the OpenStreetMap community about how to handle the case where a tramway runs along a highway. This proposal chooses to represent this as a single way, which is intended to mean simply that the highway contains at least one track of a tramway. Knowing that a street contains rails is useful to help people orient themselves while moving through an area, so this is a minimally-viable level of detail.

The remaining tags on one of these "shared" ways are specified as relating to the highway and not to the tramway, but see the lane mapping proposal below for how one can tag details about the lanes containing individual tramway tracks where desired.

This also somewhat mimics the prior art of trolley_wire=yes, which simply indicates the presence of at least one set of trolley wires over the road, which is again a useful landmark for orientation when moving around a street grid.

Mapping tram tracks as lanes within a highway

The tagging scheme for describing details of individual lanes of a highway can be extended to describe which lanes have tramways and which lanes permit tram access. (the former is possible without the latter, but the converse is unlikely.)

Lane-specific key Description
railway:lanes For each lane, an empty value indicates no railway infrastructure, while "tram" indicates tram infrastructure. Values are separated by vertical bars. For example, in a four-lane highway where the two outermost automobile lanes are shared with trams, one might set this tag to include "tram", "", "" and "tram".
train:lanes Lane-specific equivalent of train=*, describing access restrictions for rail vehicles.

The :lanes suffix allows highway-specific tags to be used on each lane. If a mapper wishes to include railway-specific tags on a per-track basis this is done via a different mechanism described below.

Detail Mapping of Railways in Two Dimensions

The simple tagging approach above represents enough detail for mapping at distant zoom levels and routing for automobiles, pedestrians and public transport users. However, it does have various limitations for those interested in the intricate details of railway operations, such as the precise locations of tracks, locations of points/switches that allow trains to move between tracks, the relationship between tracks and signals, etc.

The following is a proposal for the next level of detail that allows us to model such concepts. It is modeled after the area:highway proposal and is compatible with it, but as such it has similar advantages and disadvantages to that proposal.

Key Value Element Comment
area:railway=* any value that can be used with railway=* to describe a right-of-way area A solid area that is taken up by a railway right-of-way. Often the ground in this area is covered with ballast, which the then tracks run over. Such areas are usually off-limits to the public unless another accessible object (such as a footway or a platform) is placed on top of it. This is more specific than landuse=railway, which can describe broadly all land that is devoted to use by railways. Since railways are often long and thin, one will often use multiple railway areas that share a pair of nodes at the ends to create a chain of areas that all represent the extent of the railway right-of-way.
railway:track=* any value that can be used with railway=* to describe a right-of-way way The path of an individual track, either within an area:railway=* or (in the case of trams) inside an area:highway=*. The way must follow the course of the center point between the two running rails, ignoring any additional rails like a power rail. gauge=* can be used to describe the width of the track, and any other tag that would normally apply to a railway=* can apply here where it describes this individual track rather than the railway as a whole. Systems that make use of railway:track=* should treat it as superseding any railway=* ways within the same area:railway=*, and for the purposes of rendering either one or the other should be rendered, not both. Do not connect railway:track=* ways with highways or add railway=level_crossing nodes to them, since they are at incompatible levels of detail; it is better to connect the simpler railway=* with a highway way at a single node and identify the level crossing there. Do not include tracks in public transport route relations; public transport routes describe paths along railways rather than railway tracks and the exact tracks taken may vary based on the time of day and/or the presence of other vehicles.
designated_direction=backward backward way By default it is assumed that railway:track nodes may normally be traversed by trains only in the direction of the way. direction=backward indicates that in fact trains will normally go only against the direction of the way.
designated_direction=both both way By default it is assumed that railway:track nodes may normally be traversed by trains only in the direction of the way. direction=both indicates that in fact trains routinely pass both ways. This may be true on e.g. a single-track railway where that track is used in both directions.
railway=signal signal node Use this with nodes that are part of railway:track=* ways to show places where trains may have to wait before proceeding. Additional tags can be used on the node to describe further characteristics of the signal.

Real-world Examples

Photo Tagging Notes
Rails to Wivenhoe.jpg A simple, common case to start: a pair of rails running along a dedicated right-of-way. This entire right-of-way is represented by a single way tagged with railway=rail, optionally including tracks=2. Those interested in such details might also create area:railway=rail areas representing the ground covered by ballast and two separate railway:track=rail ways showing the path of the individual tracks, tagging the tracks as electrified=contact_line. Although it's not visible in the photo, it was taken with the photographer standing on a level crossing with a highway=residential; this would be represented by a single node that is present both on the railway way and the highway way and tagged with railway=level_crossing, but the railway:track=rail ways are not connected to the highway at all.
Sanfrancisco jchurch dolorespark.jpg On the far side of this intersection the train operates as a tram, running down the middle two lanes of a four-lane highway. (two lanes in each direction). The line then crosses diagonally over the intersection and continues behind the photographer on its own separated right of way, in order to avoid a steep incline. Some blocks later the train rejoins the same street. Under this proposal, the shared right of way would be tagged as a single way with both highway=residential and railway=tram, while the separated part would be tagged also as a single way with just railway=tram, with the four streets and the separated tramway all connecting in a single node representing the intersection. If tagging of the individual lanes is desired, the shared right of way could be tagged with railway:lanes=|tram|tram| and/or tracks=2. If this track is included in a route relation, the relation would include both the highway section containing the tramway and the separated tramway, which should share a node at the center of the intersection. Also shown in this picture is a short boarding platform that briefly interrupts the two lanes of traffic; to map this, the highway could split in two with the right-side lanes (from the perspective of the photographer) tagged as highway=residential, railway=tram, lanes=3 and the remaining left-side lane tagged as highway=residential, lanes=1, oneway=yes; this can then allow a platform way to be drawn between them. Alternatively (or additionally) one could use area:highway and railway:track to show in detail how the road and rails run in relation to the platform,
Sanfrancisco fmarketandwharves marketst.jpg This tramway is running along a separated highway with two lanes in each direction, with each direction also featuring a cycle lane. Since it's a separated highway it would be represented as two separate ways with highway=primary and oneway=yes, and since the tramway runs in both directions these ways would both also be tagged with railway=tram. If tagging of the individual lanes is desired, the each one-way way would be tagged as railway:lanes=tram|​| and/or tracks=1 and cycleway:right=lane.
Uxbridge, York Road Metropolitan Line sidings.jpg This is a subway train in an open-air train yard. The tracks in this yard are of various lengths due to interactions with other infrastructure, so a mapper must use judgement in deciding how many separate ways to use to represent this yard to show the relationships between the tracks and the infrastructure. For the purposes of basic schematic mapping the details of the yard aren't very interesting because train yards are rarely accessible to the public and it is not a route to anywhere and so the main thing is to simply show the presence and the size of the yard to aid in routing around it. The ways representing tracks here would be tagged as railway=subway and service=yard, and would not be included in any route relations because the yard is not used in revenue service. In addition one might also use railway:track=* to map the track layout and switches in detail. An extended tagging scheme could be used to map the details of the track layout and other infrastructure such as platforms, track crossing boards, buffers, etc, but that is not part of this proposal and left as an exercise for someone else who is interested.

Rendering Recommendations

The existing Mapnik rendering of railway=rail, railway=tram etc is a suitable level of detail for standalone railways at the zoom levels used on the slippy map at

Where railway=tram is applied to a highway, rendering a line of the same style as used for separated tramways along the centre of the way, on top of the street line but below the street labels, could be a reasonable way to show that a street contains rails. However, this level of detail is probably only intelligible and useful at medium zoom levels; when zoomed out, the default Mapnik style could simply ignore the presence of the tram on the street, and leave this level of detail to e.g. the Public Transport map.

Renderers using higher zoom levels than the main slippy map will probably prefer to render polygons from area:highway=* and area:railway=* and tracks from railway:track=*, and ignore highway=* and railway=* except where the details are not present.

Here are some quick example renders (of a limited dataset) using TileMill.

Schematic Rendering

At distant zoom levels we ignore the detail tags altogether and render only from the schematic:


(My quick-and-dirty TileMill style rendered the roads over the top of the rails, causing gaps. In practice the separated tram rails ought to render after the streets shapes but before their labels for correct appearance.)

Detail Rendering

At close zoom levels, on the other hand, we can prefer to use the highway and railway areas and the detailed individual rails:


(Please disregard my hastily-drawn, low-detail areas in this rendering; of course in practice detail areas should actually be detailed!)



(This is not really that useful because this doesn't tell us anything about whether the railway is tagged in the one-way-per-railway style or in the one-way-per-track style.)

The remainder of the stats in this section is of course a snapshot at the time of writing, not a real-time taginfo feed.

123,753 ways have both "railway" and "tracks" tags, while 1,282,492 have "railway" in total, so tracks are only tagged 10% of the time.

Here's the rundown for different values of tracks, as percentages of the total that have tracks annotations at all:

Tracks Value Count Percentage
1 101,012 82%
2 17,666 14%
4 3,020 2%
multiple 753 <1%
single 653 <1%
double 12 <1%

So from this we can see that for 90% of railways it's unknown whether they are tagged schematically or physically, but the remaining 10% are already tagged in a manner consistent with this proposal.