diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a171d882..c43eba89d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ _Breaking developer changes, which may affect downstream projects or sites that * Warn when a way with more than the maximum allowed number of nodes is to be uploaded and provide a way to fix it ([#7381]) * The Suspicious Names validator warning now compares the Name field to the preset’s name in the user’s language, not just the raw tag value (typically in British English). ([#9522], thanks [@k-yle]) * Revalidate ways that are connected to the currently edited way to also properly update/catch _disconnected way_s and _impossible oneway_ errors ([#8911], thanks [@andrewpmk]) +* Preserve `crossing:markings` tag when fixing missing connection of crossing path and road ([#9586], thanks [@jtracey]) #### :bug: Bugfixes * Prevent degenerate ways caused by deleting a corner of a triangle ([#10003], thanks [@k-yle]) * Fix briefly disappearing data layer during background layer tile layer switching transition ([#10748]) @@ -74,6 +75,7 @@ _Breaking developer changes, which may affect downstream projects or sites that [#7381]: https://github.com/openstreetmap/iD/issues/7381 [#8911]: https://github.com/openstreetmap/iD/pull/8911 [#9522]: https://github.com/openstreetmap/iD/issues/9522 +[#9586]: https://github.com/openstreetmap/iD/pull/9586 [#9634]: https://github.com/openstreetmap/iD/pull/9634 [#9635]: https://github.com/openstreetmap/iD/pull/9635 [#10003]: https://github.com/openstreetmap/iD/pull/10003 diff --git a/modules/validations/crossing_ways.js b/modules/validations/crossing_ways.js index a7d4aa80f..5c7751dbf 100644 --- a/modules/validations/crossing_ways.js +++ b/modules/validations/crossing_ways.js @@ -167,6 +167,8 @@ export function validationCrossingWays(context) { if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) { // one feature is a path but not both + if (!bothLines) return {}; + var roadFeature = entity1IsPath ? entity2 : entity1; var pathFeature = entity1IsPath ? entity1 : entity2; // don't mark path connections with tracks as crossings @@ -181,11 +183,15 @@ export function validationCrossingWays(context) { return {}; } if (['marked', 'unmarked', 'traffic_signals', 'uncontrolled'].indexOf(pathFeature.tags.crossing) !== -1) { - // if the path is a crossing, match the crossing type - return bothLines ? { highway: 'crossing', crossing: pathFeature.tags.crossing } : {}; + // if the path is a crossing, match the crossing type and markings + var tags = { highway: 'crossing', crossing: pathFeature.tags.crossing }; + if ('crossing:markings' in pathFeature.tags) { + tags['crossing:markings'] = pathFeature.tags['crossing:markings']; + } + return tags; } // don't add a `crossing` subtag to ambiguous crossings - return bothLines ? { highway: 'crossing' } : {}; + return { highway: 'crossing' }; } return {}; } diff --git a/test/spec/validations/crossing_ways.js b/test/spec/validations/crossing_ways.js index 58bcbe905..bb0a55b8d 100644 --- a/test/spec/validations/crossing_ways.js +++ b/test/spec/validations/crossing_ways.js @@ -292,6 +292,16 @@ describe('iD.validations.crossing_ways', function () { verifySingleCrossingIssue(validate(), { highway: 'crossing', crossing: 'unmarked' }); }); + it('copies over `crossing:markings`', function() { + createWaysWithOneCrossingPoint({ highway: 'residential' }, { highway: 'footway', crossing: 'marked', 'crossing:markings': 'zebra' }); + verifySingleCrossingIssue(validate(), { highway: 'crossing', crossing: 'marked', 'crossing:markings': 'zebra' }); + }); + + it('does not copy `crossing` and `crossing:markings` if the `crossing` tag has an unknown value', function() { + createWaysWithOneCrossingPoint({ highway: 'residential' }, { highway: 'footway', crossing: 'zebra', 'crossing:markings': 'zebra' }); + verifySingleCrossingIssue(validate(), { highway: 'crossing' }); + }); + it('flags road=track crossing footway', function() { createWaysWithOneCrossingPoint({ highway: 'track' }, { highway: 'footway' }); verifySingleCrossingIssue(validate(), {});