RU:JOSM/Plugins/PT Assistant

From OpenStreetMap Wiki
Jump to navigation Jump to search

Документация модуля Public Transport Assistant: Введение

Модуль проверяет маршруты общественного транспорта на соответствие набору критериев и, по возможности, предлагает способы их исправления.

Модуль не имеет специального пользовательского интерфейса, он полностью интегрирован в ядро Проверки данных JOSM.

Эта страница отражает состояние модуля только на момент перевода английской версии статьи (04.02.2026). С проблемами разработки можно ознакомиться в хронологическом порядке здесь.

Доступна презентация модуля на конференции FOSS4G (Брюссель, 22.09.2016) здесь.

Исходный код плагина находится в репозитории JOSM на github.

Смотрите также JOSM/Plugins/PT Assistant/Goals

Обзор

Отношения маршрутов, для которых можно сообщать об ошибках и предлагать исправления

Существует две версии схемы общественного транспорта, поэтому некоторые типы маршрутов могут отличаться друг от друга.

Связь с маршрутом проверяется модулем, если она:

И

И

  • не имеет тега bus=on_demand - Автобусы on_demand (по требованию) не имеют фиксированных маршрутов, но, как правило, имеют список остановок, на которые они могут заезжать (некоторые сетевые операторы могут обслуживать дополнительные остановки после специального бронирования и авторизации, если это позволяют безопасность остановки и местные условия дорожного движения). Такие маршруты невозможно описать и добавить в OSM.

Используемые роли участников отношения "Маршрут"

Критерии для platforms (Платформа) и stop_positions (Место остановки транспорта) (PTStop):

Каждая остановка соответствует классу плагина PTStop. Если отношение маршрута содержит два последовательных элемента, принадлежащих одной и той же остановке (Платформа и Место остановки транспорта), они образуют одну остановку PTStop.

Критерии для линий (PTWay):
  • Если OsmPrimitiveType не может быть точкой
  • Если OsmPrimitiveType это линия, тогда участник отношения может не иметь тегов public_transport=platform, highway=platform или railway=platform
  • Если OsmPrimitiveType является отношением, этому вложенному отношению разрешено иметь только линии в качестве членов.

Если элемент связи маршрута не соответствует этим критериям, он не добавляется в модель, вместо этого появляется предупреждение "PT: Relation member roles do not match tags" ("PT: роли участников отношения не соответствуют тегам").

Доступные в настоящее время тесты

# Предупреждающее сообщение В чем же проблема? Что произойдет, если я нажму кнопку "Fix"? Author
1 PT: Route type does not match the type of the road it passes on Тип маршрута (например, автобус/трамвай/поезд и т.д.) должен проходить по маршруту, соответствующему данному типу, например, поезда должны проходить по рельсам, а автобусы не должны проходить по улицам, предназначенным только для пешеходов или велосипедов. JOSM увеличивает масштаб до проблемы, выбирает проблемные линии и открывает редактор отношения для соответствующего маршрута. darya
2 PT: Road is under construction Есть дорога, которая помечена как строящаяся. JOSM увеличивает масштаб до проблемы, выбирает проблемные линии и открывает редактор отношений для соответствующего маршрута. darya
3 PT: Route passes a oneway road in wrong direction The way is tagged as oneway, and the route passes it in the wrong direction. This test only works for single ways but does not detect more complex sequences of wrongly directed ways and roundabout parts. JOSM увеличивает масштаб до проблемы, выбирает проблемные линии и открывает редактор отношений для соответствующего маршрута. darya
4 PT: Route contains a gap that can be fixed by sorting Если участники отношения маршрута обрабатываются в текущем порядке, в непрерывности происходит разрыв (фиктивный разрыв). Если бы выполнялась сортировка, разрыва не было бы. Кроме того, это сообщение указывает на то, что на этом маршруте больше не обнаружено проблем, поскольку в случае реальных пробелов (отсутствия путей) сортировки было бы недостаточно для устранения пробелов. Участники отношения маршрута сортируются. darya
5 PT: Relation member roles do not match tags A route relation member does not fulfill the criteria for PTStop or PTWay listed above under "Relevant route relation members". Исправление недоступно. darya
6 PT: Route should start and end with a stop_position There is no stop_position at the beginning or at the end or the route. Исправление недоступно. darya
7 PT: First or last way needs to be split The stop_position at the beginning/end of the route exists but it is not a first or last node of the way. Исправление недоступно. darya
8 PT: Stop_position is not part of a way The stop_position is not referred by any way with a public-transport-related tag (such as platform, railway, etc.). The user is asked if they want to change the node tag value to "platform". If the user presses "yes", the tag is corrected. darya
9 PT: Platform should not be part of a way The platform is referred by a way. The user is asked if they want to change the node tag value to "stop_position". If the user presses "yes", the tag is corrected. darya
10 PT: Stop not served The stop (and its elements platform and/or stop_position) are located too far away (>=0.002 degrees) from any way of the given route. Исправление недоступно. darya
11 PT: Problem in the route segment with one automatic fix The ways between two consecutive stops (as listed in the route relation) are not continuous. This may be for a variety of reasons: segments absent or unnecessary segments present, wrong sorting, unsplit ways, etc. The ways of the route segment (i.e. the part of route between two consecutive stop) are substituted with ways from the corresponding correct segment or from the ways that constitute the given route. JOSM zooms in to the problem. darya
12 PT: Problem in the route segment with several automatic fixes The ways between two consecutive stops (as listed in the route relation) are not continuous. This may be for a variety of reasons: segments absent or unnecessary segments present, wrong sorting, unsplit ways, etc. The fix variants are displayed in different colors and JOSM zooms in to the problem. The first 5 variants can be displayed and marked with letters A-E. The user can either select the corresponding letter or press Esc for no fix. Once a fix variant is selected, the route is modified and a Relation Editor window opens, with the problematic ways selected. darya
13 PT: Problem in the route segment with no automatic fix The ways between two consecutive stops (as listed in the route relation) are not continuous. This may be for a variety of reasons: segments absent or unnecessary segments present, wrong sorting, unsplit ways, etc. Исправление невозможно darya
14 PT: Stop area relation has no stop position There is a stop area relation without any given stop position. Исправление невозможно xamanu
15 PT: Stop area relation has no platform There is a stop area relation without any given platform. Исправление невозможно xamanu
16 PT: Stop position or platform is not part of a stop area relation All elements marked as stop position and platforms should be ideally part of a stop relation. Исправление невозможно xamanu
17 PT: Route relations of stop position(s) and platform(s) of stop area members diverge There is a discrepancy of public transport route relations assigned to stop position(s) and platform(s) which are part of one stop area relation. Исправление невозможно xamanu

Recommendations

  • Activate the "Use error layer" option for a better visualization of the problematic primitives (Preferences => Data Validator => Tests => Use error layer).
  • If you activate the "Download incomplete route relation members" option in the Preferences => PTAssistantPlugin settings while working on a large dataset, select the desired route relations before validating, otherwise the download of incomplete members may take too long.
  • Open the "Command Stack" window in JOSM, especially if you are using the automated fixes for route-segment-related warnings ("PT: Problem in the route segment..."). It will help you see which changes have been carried out and revert them if necessary.

pt_assistant layer

The plugin adds an extra layer named "pt_assistant" to the layer list. The layer will be shown as soon as the user selects a route relation. Though primarily aimed at public transport relations, it will activate for bicycle or hiking relations as well. Once at least one relevant route relation has been selected, it receives a purple coloring. The stops are numbered according to their order in the relation.

pt_assistant layer showing the selected route (#8) in purple with stops (#8 and 9) in white and routes that use these stops in pink. Simple white triangles show a oneway way (north), two-directional white triangles show a oneway way where public transport vehicles are allowed to pass in both directions (south).

Stop-by-stop tests and multiple fix variants

Fix variants displayed in the map frame

Tests #11-13 in the table use the stop-by-stop approach. This means they look separately at each part of the route between two consecutive stops (referred to as 'route segment' in this documentation). If no error was found in a route segment, that segment is added to the list of correct segments. These tests search for fix variants in the following order:

  1. Search in the list of correct segments for a segment whose first/last ways equal the first/last ways of the given problematic route segment
  2. Try to re-order and remove ways of the problematic segment itself in order to achieve a continuous sequence of ways between the two stops
  3. Search in the list of correct segments for a segment whose first/last stops equal the first/last stops of the given problematic route segment (in this case, the notification "Warning: the displayed fix variants are based on less strict criteria" is displayed)

The stop-by-stop tests (#11-13) may have several fix suggestions. If the fix button is pressed in such cases, the suggestions are displayed using different colors in the pt_assistant layer. Up to 5 fix variants can be displayed. They are labeled using the letters A-E. The user can select the desired fix by typing the corresponding letter on the keyboard. The Esc key can be pressed for no fix.




Data model

The plugin classifies the route relation members into PTStops (class PTStop) and PTWays (class PTWay).

A PTStop is designed to model a consecutive stop_position and platform as a single stop if they are close enough (<0.002 degrees) to each other. A PTStop can store the stop_position and/or platform as its elements.

A PTWay represents the way-related members of a route relation. The relation member can be a way or a relation.

The criteria for both PTStop and PTWay are listed above (Scope). If a route relation member does not fit the definition of either of these classes, it results in a "PT: Relation member roles do not match tags" (#5 in the table) warning.

Although not (widely) used in the current set of validator tests and fixes, the plugin has the potential to handle nested relation members, i.e. cases when a member of a route relation is itself a relation. The prerequisites are that the nested relation may only include ways (no stops) and the order of the ways inside the nested relation must be correct (because it is not further validated). The basis for this has been implemented in the classes PTWay and PTDataManager.

Stop-to-way assigner

Stops need to be linked to the relevant way of their route relation. Typically, that is the way closest to the stop in question. The search for the relevant way takes place in the following order:

  1. Check if this stop has already been assigned to a way. The assigned stops are stored in a table (HashMap).
  2. If the stop has a stop_position, use it to find the way that stop_position belongs to.
  3. If the stop elements belong to a stop_area relation, search if that stop_area contains a stop_position and use its referring way.
  4. Search for a stop_position in the vicinity of the stop (distance threshold 0.002 degrees).
  5. Use a growing-bounding-boxes algorithm. Find nodes inside a bounding box of a given size (which increases after each unsuccessful search loop), then find the ways of the current route to which those nodes belong. If there are multiple potential a way, the closest way is selected by calculating the distance from a point to a line. This calculation is based on the formulas for triangle area (Heron's formula and 1/2 * base * height).

"Public Transport" menu items

"Public Transport" menu

A specific menu have been added to JOSM menu from the pt_assistant plugin with items:

  • Split roundabout: Roundabouts can be made up of 1 closed way, but this looks ugly when representing the route visually. The ways are split on those nodes that have ways, which are members of route relations (except when it's route=road). Then each route relation is treated and those ways of the roundabout that aren't needed are removed.
  • Transfer details of stop to platform node:
  • Sort PT Route Members:
  • PT Wizard:
  • Visualize public transport routes:
  • Distance between stops:
  • Customize stops:



New map modes and add to Mode menu

"Add stop position" and "Edge selection" items in the Mode menu

Two items have been added to JOSM Mode menu from the pt_assistant plugin:

  • Add stop position: adds a stop_position node at a specified location, includes tags. If this is the first or the last way of the itinerary the way is split and only the part that really belongs to the route is kept.
  • Edge selection: Select several connected ways that are suitable for the mode of transport, for which the relation editor window has focus. An edge is a continuous set of ways between 'forks' or between a fork and where a stop_position is the end node of a way.


























Настройки

Settings for the pt_assistant plugin

Пользовательские настройки сохраняются в разделе Правка => Настройки => Настройки PTAssistantPlugin:

  • Validator :
    • The user can select if the incomplete relation members should be downloaded. In case a route relation has incomplete members that were not downloaded, that relation is skipped without validation.
    • The user can decide to exclude tests that enforce the addition of stop_area relations for each stop.
  • Move detail to nodes next to highway/railway :
  • Routing Assistant :
  • Split way at start/end of route relations mapping mode :

Смотрите также