Proposal:Refined Public Transport/Consuming

From OpenStreetMap Wiki
Jump to navigation Jump to search

This is a page for data consumers, who want to use public transport data, mapped in accordance with the PTv3 proposal.

Rendering

If you just want to draw coloured lines where there is a PT route, do the same as before: find all route relations and highlight ways with highway and railway (and some other route segment tags). Use the colour from colour tag of the relation, if present. Highlight all other objects from a relation as stops.

Stop Areas

The main concept of the PTv3 schema is a stop area. It is a relation that links the stop or station object (single for each stop area) with all other relevant objects: platforms, entrances, stop positions. A single stop is equal to a stop area. If there are different stop areas (even with same members), then these are different stops.

Before using the data, you need to parse all stop area relations and sort its members based on tags, into the three above mentioned groups. See the tag lists on the proposal page.

Finding objects

How to get a platform from a route relation

Iterate over non-segment route relation members, and group these by stop_area parents. For a given stop:

  • If there is a single object in the route relation, that's your platform.
  • If there are multiple, first find the first one with the platform tags.
  • Otherwise, use the first one with the stop position tags.
  • Otherwise, use the first one with the stop or station tags.
  • Otherwise, just use the first one you find.

How to get a point to route to

Find the platform, as outlined above. If you can route straight to it (not to the coordinates, since it can be underground), great: do it.

Otherwise, find a stop_area relation for that platform, and look for entrances. If there are any, route to them. if not, navigate a user as close to the platform as possible.

How to get a station data

All tags for a stop or a station, including its name, reference number, operator and so on, are placed on the stop or station object, most commonly a node.

To find it, take a platform, get the stop_area relation for it and find the first object with any of the stop or platform tags, listed in the proposal.

No stop area

When you have a platform, but no stop areas, that is not fully compatible with PTv3. But such cases are aplenty. Use the geometry: take all entrances up to, say, 200 meters from a platform, and to get a stop or station object, find the closest one in up to 50 meters from the platform center. Note that this is prone to errors, especially when there is an underground PT network or an interchange.