openstreetmap/iD

Show warning when turn restrictions get broken

開放

#9,346 建立於 2022年10月28日

 (5 則留言) (3 個反應) (0 位負責人)JavaScript (1,449 個分叉)github user discovery
help wantedvalidation

倉庫指標

星標
 (3,818 顆星)
PR 合併指標
 (平均合併 29天 14小時) (30 天內合併 82 個 PR)

描述

Description

When nodes or ways that are used as members of relations with type=restriction are edited or deleted these relations can become broken. Maybe this is something that should be validated, so a warning will be shown if restrictions are broken?

According to the wiki such validation should check that every relation of type=restriction:

  • has one or more members with role 'from' and type 'way'
  • has one or more members with role 'to' and type 'way'
  • has exactly one member with role 'via' and type 'node' or one or more members with role 'via' and type 'way'

If we wanted to go further also these things could be validated:

  • there should be no members with roles other than 'from', 'to' and 'via', which means also no members with an empty role. the only exception might be the location_hint role, but it is already deprecated in the wiki
  • there should never be more than one member with role 'from' and more than one member with role 'to'
  • all members with role 'via' must be connected with each other if they are ways
  • probably easy: all members with role 'from' and 'to' must be connected with the member with role 'via', if it is a node. the via node must be the first or last node of the from/to member ways (ways must be split at the via node).
  • probably harder: all members with role 'from' and to 'to' must be connected with the via members if they are ways.

I found about 20000 restriction relations that have no from or to member in the current planet OSM file (this seems to be the most frequent issue). Many I looked at used to have these members, but then they were deleted, because someone edited some ways in that area, and often used iD for this.

If you think this is useful I could try to provide a PR that does this.

貢獻者指南