Public transport
Feature : Public transport |
Description |
Railways, buses, trams, etc. |
Tags |
An overview of current public_transport=* (or mass transit) related tagging.
Introduction
Why do we map public transport in OpenStreetMap?
The main role of street maps has generally been to help people navigate when walking, or when using private motor vehicles on the public highway system. Public transport provides an alternative which is often faster, more environmentally sustainable, and sometimes even more convenient.
Unlike with walking and driving, where it's enough for maps to simply describe the street and footpath layout, allowing people to decide their own route and schedule, with public transport, we need to describe the infrastructure (e.g., the train tracks) as well as the services which operate on them (e.g., bus lines, express trains and local trains).
Whilst OpenStreetMap is probably not the place for full timetable information, adding information about public transport infrastructure and services to the map means that we can provide basic routing services. Very few other maps currently do this (although Google Transit is also making improvements in this area). Bus stops and similar features are also good orientation points.
Discussion only about public transport on OSM takes place on the talk-transit mailing list and on Liste Transport in French, but related discussion takes also place on tagging mailing list and in other contact channels.
Different tagging schemas
As time passed, several tagging schemas were developed and were/are in use.
- The Original Public Transport Schema, sometimes called Public Transport Version 1 (PTv1) is still (2024) widely in use, and most of the tags are more common than newer alternatives. Some mappers discourage using these tags, although none have been deprecated.
- The Oxomoa Schema was a schema which has large similarities to Public Transport Version 2. It is no longer used for new features. You might sometimes find route relations which were created around 2010 and have not been modified since that time. It is documented on User:Oxomoa/Public transport schema. Don't use it for new relations and migrate existing relations to the new schema. It is linked here for documentation purposes.
- The New Public Transport Schema has been called Public Transport Version 2 (PTv2) since 2014. It was approved in 2011. The original wording of its proposal can be found at Proposed features/Public Transport - note that this proposal did not deprecate any existing tags.
- The Refined Public Transport Schema is a proposal started in 2018 to simplify the current scheme. Details at Proposed features/Refined Public Transport.
Types of public transport
Public transport comes in various different forms and types. Each type is usually distinguished by the technology and infrastructure it uses. For example, railways use trains running on metal rails, buses use the main road network, and air planes use the sky …
Some types may blur the boundaries a little. For example, trams are a form of 'light rail' (using lighter-than-normal train vehicles) which typically run on metal rails embedded into public roads (although may also have sections of dedicated track). There might also exist differences in signalling and the priority at intersections (in some cities trams are prioritised by traffic signals).
In some cases a public transport line can change its type. The following pictures show the Badner Bahn (OSM relation) from Vienna (Austria) to Baden (near Vienna, Austria), also known as "Lokalbahn" (literally "local train")
The distinctions can be even more subtle. Buses and coaches, for example, both use motor vehicles on the public road network, however coaches tend to be bigger and more comfortable, and used for longer distances (with fewer stops).
Whilst it may be tempting to try and come up with definitions for these different types, ultimately, maps are most useful if they match with people's expectations. So, when choosing which type a particular public transport service falls into, it's generally best to go with whatever the users of that service general understanding of it would be.
Buses
- Main article: Buses
Buses, coaches, guided-buses and trolleybuses all operate mainly on the highway and use similar tagging (for trams see the Trams section below).
Simple bus stops have been tagged with just highway=bus_stop for a long time. Most of them are mapped as a node on the side of the road where the people wait, usually at the location of the bus stop sign. Some were mapped as a node on the road itself where the vehicle stops.
public_transport=* instead uses two tags, one for the position where passengers wait, and one on the highway=* where the vehicles stop. The following is mapped per direction of the road:
If there is no real platform and you will only find a simple sign for the passengers … | If there is a real, dedicated platform for waiting passengers (usually a different paving, a Kassel kerb or a tactile paving) … |
---|---|
Add a node at the location of the bus stop sign. It gets following tags:
|
You can choose to map more detail and include the platform as a way, in the case that there is a physical, elevated platform at the bus stop or station. You should also map the highway=bus_stop node in addition. To map, the platform is mapped as a unclosed way (line) or an area . It gets following tags: |
If you choose to add a stop position node, place a node on the road where the bus stops. Stop position locations can be derived from the location of the bus stop or platform, and are not necessary. In some complex cases, they can add detail. The node on the highway or busway should have following tags:
- public_transport=stop_position
- bus=yes
- optional: name=<name>
Note that there is hardly any (if any at all) map that renders public_transport=stop_position.
Because a bus stop may consist of multiple objects, some people use a relation with type=public_transport and public_transport=stop_area to connect them. All objects on both sides of the street belonging to the bus stop should be included in one relation. Some mappers use multiple relations to show which bus_stop node, platform way and stop_position belong together when this is ambiguous. You can set the role stop
(for public_transport=stop_position) and platform
(for public_transport=platform).
Wires used by trolley buses can be mapped by adding trolley_wire=yes to the highway. The highway=bus_guideway tag should be used for sections of guided busway.
Every transit service (e.g., No. 38) is then represented as one route master relation containing one, two or more itinerary variants route relations, one for each direction.
As mapping buses is a complex topic in OpenStreetMap, this page is limited.
Railways
- Main article: Railways
Railway services (mainline, metro, light rail, tram, subway, etc.) all generally operate on rails. The main railway infrastructure is defined using railway=*.
The stops of railways (except trams and tram-like light rails) are mapped as a node (some people also use areas) with railway=station or railway=halt. This tag is only used once per station/halt.
Mapping of stop positions and platforms is done similar to buses:
- stop position (where the vehicle stops): public_transport=stop_position + train=yes + railway=stop + name=* (name is the name of the station)
- platform: public_transport=platform + railway=platform
railway=subway_entrance can be used to define entrances to metro stations. Stations of subways are tagged with railway=station and station=subway. The latter tag is used to indicate that a station is a subway station.
See the wiki pages Tag:railway=station, Tag:railway=halt, Tag:public_transport=stop_position and Tag:public_transport=platform for further informations about the usage of these tags.
Train routes can be mapped with route=train.
Trams
- Main article: Trams
Trams are a form of light rail which can share their path with the road for some part of their route.
Trams use the railway=tram tag. Avoid using the same way for a tram as being used for the road (highway=*). Otherwise it is not obvious if additional tags are properties of the road or of the tram. For example, maxspeed=30 might mean that the speed limit of the road is 30 km/h but it could also mean that the speed limit of the tram is 30 km/h if the way is tagged with both highway=* and railway=tram.
See Tag:railway=tram for more details about mapping trams.
Instead of railway=stop, use railway=tram_stop to mark the stop position on the track. railway=station and railway=halt are not used for tram stops.
The usage of other tags is similar to railways:
- stop positions: public_transport=stop_position + tram=yes + railway=tram_stop + name=* (name is the name of the tram stop)
- platforms: public_transport=platform + railway=platform.
If the "platform" is just a pole with a sign and the tram stop is on the road without a physical platform, use a single node tagged with just public_transport=platform (omitting railway=platform) to mark the waiting spot.
If the stop is a dual bus + tram stop, a single public_transport=platform object can be shared by both transport modes. In that case if a physical platform exists, the railway=platform tag can be added to the highway=platform way instead. However, two separate public_transport=platform objects can also be used if e.g. the transport agency has assigned different ref numbers or names for bus and tram stops at the same physical platform.
Aircraft
- Main article: Aeroways
Flight paths aren't included in the OSM database. However, this mode of transport does use an extensive range of physical on-the-ground infrastructure, including airport terminals, taxiways, runways, and connecting transport services, and all of these features can be added to OSM.
Ferries
- Main article: Ferries
The route of a ferry service can be defined using ways tagged with route=ferry. For sections of route across open water such as the sea, lakes and wide rivers a new linear way tagged as route=ferry should be created. For rivers using waterway=river add route=ferry to this way. If the ferry service ends along the length of an existing river then the river's way should be snipped into two at the point where the ferry service terminates. It is not clear how one tags a ferry that crosses a river that is constructed from a single way as both ends of the ferry would be at the same point. It is possible that adding route=ferry to a node on the river may be appropriate, similar to a crossing point on a road.
Places where people and vehicles can access ferry services should use amenity=ferry_terminal. (The tags public_transport=platform and public_transport=station are generally not used for ferries). The complete route for a ferry can be described using a route relation using route=ferry.
Cable cars, chair lifts, gondolas, etc.
- Main article: Aerialway
Cable-cars, drag-lifts, chair-lifts and gondolas can be modelled using aerialway=*. These are sometimes used as a form of public transport, but more commonly are private services only available to customers of a recreational or amusement facility, such as a winter sports park or theme park.
Aerial way stations are tagged as aerialway=station. Tags such as public_transport=station and public_transport=stop_position are generally not used.
Service routes
- Main article: Relation:route
In addition to modelling the infrastructure on which vehicles operate and the places where people embark and disembark from transit services, it is also useful to model the public transport services themselves. In particular, this makes it possible to provide public transport routing services.
A route is a relation that describes the physical path taken by the vehicles through the infrastructure by a transit service which is known to the public with a particular reference or name. The relation contains
- First, a list of all stations in the order: stop_position 1, platform 1, stop_position 2, platform 2, … Stop positions get the role stop, platforms the role platform. In some places it is deemed necessary to add the stop_positions/platforms, if they are mapped but it is not necessary to add them if they are missing just to be able to add them to the relation. In other places (like e.g. Belgium) preference is given to add only 1 object per stop to the route relations.
- The list of stops and platforms is followed by an ordered list of the ways which are used by the vehicle from the starting station to the terminal station. Each direction of the route must have its own relation; no forks are permitted. If there are multiple different routes from the starting station to the terminal station, each variant must have its own relation.
- Sections in which boarding and leaving vehicles is available upon request independent of stops can be marked with hail_and_ride.
Key | Value | Comment | Presence |
---|---|---|---|
type | route | This is a route relation. | Mandatory |
route | train / subway / monorail / tram / bus / trolleybus / ferry | Type of public transport vehicle. Mind that light_rail is in use, but it was not one of values included in the public transport proposal approved in 2010. | Mandatory |
from | Name of the station | Name of the starting station | Recommended |
to | Name of the station | Name of the terminal station | Recommended |
via | Name of the stations | Intermediate stops if different variants per direction exist. Add the stations which make the difference between two routes. | Recommended if multiple variants exist per direction |
name[1] | <type of transport><reference number>: <from> → <to> | This article or section contains questionable, contentious or controversial information. See the talk page for more information. Descriptive naming is generally frowned upon. This recommendation has attracted criticism many times over the years. Human readable description of the route. <reference number> should be the value of ref=*. Examples: "Bus 201: Uitikon Waldegg, Bahnhof → Uitikon, Wängi" for a bus route or "Train RE 7: Dessau Hbf → Wünstorf-Waldstadt" for a train route. If the line has no number in reality, only use the word "Bus" for buses or the type of train (e.g., IC, TGV or RE) for trains (e.g., RE Würzburg Hbf → Stuttgart Hbf). Note that "->", "=>", and "-->" can all be used in the place of the Unicode character "→". |
Recommended |
official_name | Text | The name of route as it appears on official maps. | Recommended, if one exists. |
ref | Text | Reference number which is valid on the whole line; e.g., "RE 7" or "S 5". | Recommended if no route_master=* exists, else optional |
ref:<abbreviation> | Text | Reference number of the line which is assigned by a local authority, differs from ref=* and is not in use on the whole line (e.g., line through two states, each state uses a different number for the line). Example: ref:VRN=R 85 . |
Recommended if no route_master=* exists, else optional |
operator | Text | Name of the company operating the route. There is no consensus whether you should use abbreviations or not. Multiple names are separated by semicolons. | Recommended if no route_master=* exists, else optional |
network | Text | Name of the network(s) the route belongs to. This is usually an abbreviation such as TTA or CHT. The names of the German Verkehrsverbünde go into this tag. There is no consensus whether you should use abbreviations or not. Multiple names are separated by semicolons. | Recommended |
interval=* | Text | The time between arrivals at any given stop along the route. Also known as the service frequency or headway. Use HH:MM:SS, H:MM:SS, HH:MM, H:MM, MM, or M format. Example: interval=00:06:30 indicates a that the arrivals are 6.5 minutes apart. | Recommended |
duration=* | Text | The duration of the bus route, or the time between the bus leaving the first stop and arriving at the last stop. Use HH:MM:SS, H:MM:SS, HH:MM, H:MM, MM, or M format. Example: duration=00:31 indicates that from the start to the end, the travel time is 31 minutes. | Recommended |
colour | Text | Colour of the line symbol (English HTML colour name or web colour in hexadecimal form (e.g., #ff00ff ) |
Recommended if no route_master=* exists, else optional |
service | Text | Trains only: type of train service. This tag should make distinction between different types of train easier beyond borders in order that users do not have to parse reference numbers.
|
Recommended for trains |
public_transport:version | 1 or 2 | Version of the tagging scheme being used. This makes it easier for data consumers to interpret the data. | Recommended if the route follows the PTv2 scheme |
All the routes belonging to the same service can be put into a master relation with type=route_master, containing all the keys that are valid for all sub-relations, directions and variants.
Route master relations
Because the two directions of a route are split up into at least two relations using PTv2, mappers are encouraged to add route master relations. They link the routes of a line with each other. The route master relation has only the tags which are common among all its route relations. It contains only relations as members.
Route master relations should not be used to connect different lines of a network. They should only be used to connect different variations of a route. The different directions should be added to this relation. If only one relation is used to map the public transport route, which can happen if the route completes a round trip, no route master is needed.
Key | Value | Comment | Recommendation |
---|---|---|---|
type | route_master | This is a master route relation. | Mandatory |
route_master | train / subway / monorail / tram / bus / trolleybus / ferry | Type of public transport vehicle | Mandatory |
name[1] | <type of transport> <ref> | This article or section contains questionable, contentious or controversial information. See the talk page for more information. Descriptive naming is generally frowned upon. This recommendation has attracted criticism many times over the years. Human readable description of the route. <ref> should be the value of ref=*. Examples: Bus 201, Train RL, Ferry 31. |
Recommended |
ref | Text | Reference number which is valid on the whole line; e.g., "RE 7" or "S 5". | Recommended |
ref:<abbreviation> | Text | Reference number of the line which is assigned by a local authority, differs from ref=* and is not in use on the whole line (e.g., line through two states, each state uses a different number for the line). Example: ref:VRN=R 85 |
Recommended if the reference differs across networks |
operator | Text | Name of the company operating the route. There is no consensus whether you should use abbreviations or not. Multiple names are separated by semicolons. | Recommended if available |
network | Text | Name of the network(s) the route belongs to. The names of the German Verkehrsverbände go into this tag. There is no consensus whether you should use abbreviations or not. Multiple names are separated by semicolons. | Recommended if available |
colour | Text | Colour of the line symbol (English HTML colour name or web colour in hexadecimal form (e.g., #ff00ff ) |
Recommended if available |
service | Text | Trains only: type of train service. This tag should make distinction between different types of train easier beyond borders in order that users do not have to parse reference numbers.
|
Recommended for trains |
Members of this relation are
Role | Refers to | Comment | Recommendation |
---|---|---|---|
<empty> | All route variant/direction s | Mandatory |
Note: Except for service=car being used on Amtrak's Auto Train, tagging service=* on a type=route route=train does not appear to be in wide use in USA (possibly North American) rail tagging. This tagging does seem prevelant in Europe.
Toolbox
A very large collection of tools are available around public transport.
Maps
There are several people creating specialist public transport maps:
- The Transport Map layer on OSM's front page by Andy Allan
- Öpnvkarte (öpnvkarte.de) (Also available at openbusmap.org for those with no Ö accessible)
- Openptmap (Openptmap in FacilMap) shows public transport lines.
- OpenStreetBrowser (openstreetbrowser.org) In the "transportation" layer you can search for routes and stops, and you can also view transportation routes that pass through a particular stop or station.
- OpenRailwayMap (openrailwaymap.org) Railways map.
- PTMap base on the Overpass API by Stephan Bösch-Plepelits
- OSM Public Transports based on the Overpass API by Nicolas Bétheuil
- JustGo ! Global based on the Overpass API by clementroux
- DE:Flosm (www.flosm.org/en/publictransport) public transport theme map
- OsmAPP (osmapp.org) By clicking on the stops you can obtain information and visualization about the routes served.
Mailing list
The talk-transit mailing list was created specifically for discussion of public transport related stuff.
A French speaking mailing list is also available.
Public transport by country
Dedicated information for specific countries or even cities can be found in Category:Public transport by country.
Imports
List of transit data imports. Good place to start to see how it's been done elsewhere but be sure to follow Import/Guidelines and Automated Edits code of conduct.
Project | Location | Summary |
---|---|---|
Import/VTA Transportation | Santa Clara, California, United States | stops |
NaPTAN | UK | stops |
Switzerland/DIDOK | Switzerland | stations |
VRS/Haltestellenimport(de) | Cologne, Germany | stops |
Tenerife Bus Transport Import | Tenerife, Canary Islands | stops & routes |
(undocumented: see [1]) | Ottawa, Canada | stops |
Bus stop import Norway | Norway | Bus stops and stations; nsr2osm converts and syncs with NeTEx files |
OCTA Import | Orange County, California, United States | stops |
King County Metro stop import | King County, Washington, United States | stops |
GTFS standard
- Main article: GTFS § Conversion of OpenStreetMap and GTFS
There are tools to import GTFS data into OSM at various levels of semi-automation.
See also
- Proposed features/Public Transport
- Buses and railway=*
- Ideas in Transit
- public_transport=*
- Relation:public_transport
- Proposed features/Simplified Public Transport Scheme
- Proposed features/Customized Icons for Public Transport
- OpenTripPlanner
- landuse=railway
Further reading
- Enabling Cost-Effective Multimodal Trip Planners through Open Transit Data
- GroundTruth presentation to World Bank Transport Forum
Footnote
- ↑ 1.0 1.1 Using name=* instead of description=* mismatches how name tag is supposed be used but follows proposal. See https://lists.openstreetmap.org/pipermail/tagging/2019-May/045180.html for one of discussions of this conflict.
|