From e4641b581f9ea5bb3e2a842432f7afdc616c1d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Thu, 25 May 2023 04:17:34 -0700 Subject: [PATCH] Offer to connect sidewalk to service road without tagging crossing (#9650) --- CHANGELOG.md | 2 ++ data/core.yaml | 2 ++ modules/validations/crossing_ways.js | 29 +++++++++++++++++++++------- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ba34802f..aa2784e66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ _Breaking developer changes, which may affect downstream projects or sites that #### :scissors: Operations #### :camera: Street-Level #### :white_check_mark: Validation +* Offer to connect sidewalk to service road without tagging the connection as a crossing ([#9650], thanks [@1ec5]) #### :bug: Bugfixes * Fix `multi/many/semiCombo` options for not being selectable immediately after removing them for fields with predefined options * Fix a bug where the _Add_ input element on comboboxes with a fixed set of allowed options is still hidden after an option of a previously "fully saturated" field is removed @@ -73,6 +74,7 @@ _Breaking developer changes, which may affect downstream projects or sites that [#9637]: https://github.com/openstreetmap/iD/pull/9637 [#9638]: https://github.com/openstreetmap/iD/pull/9638 [#9640]: https://github.com/openstreetmap/iD/issues/9640 +[#9650]: https://github.com/openstreetmap/iD/pull/9650 [@biswajit-k]: https://github.com/biswajit-k diff --git a/data/core.yaml b/data/core.yaml index ebe5892e4..37e18ea69 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -1931,6 +1931,8 @@ en: title: Connect this feature connect_features: title: Connect the features + connect_using_crossing: + title: Connect using a crossing connect_using_ford: title: Connect using a ford continue_from_start: diff --git a/modules/validations/crossing_ways.js b/modules/validations/crossing_ways.js index 2195ea8e4..e20210335 100644 --- a/modules/validations/crossing_ways.js +++ b/modules/validations/crossing_ways.js @@ -123,9 +123,8 @@ export function validationCrossingWays(context) { motorway: true, motorway_link: true, trunk: true, trunk_link: true, primary: true, primary_link: true, secondary: true, secondary_link: true }; - var nonCrossingHighways = { track: true }; - function tagsForConnectionNodeIfAllowed(entity1, entity2, graph) { + function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) { var featureType1 = getFeatureType(entity1, graph); var featureType2 = getFeatureType(entity2, graph); @@ -141,11 +140,18 @@ export function validationCrossingWays(context) { // one feature is a path but not both var roadFeature = entity1IsPath ? entity2 : entity1; - if (nonCrossingHighways[roadFeature.tags.highway]) { - // don't mark path connections with certain roads as crossings + var pathFeature = entity1IsPath ? entity1 : entity2; + // don't mark path connections with tracks as crossings + if (roadFeature.tags.highway === 'track') { + return {}; + } + // a sidewalk crossing a driveway is unremarkable and unlikely to be interrupted by the driveway + // a sidewalk crossing another kind of service road may be similarly unremarkable + if (!lessLikelyTags && + roadFeature.tags.highway === 'service' && + pathFeature.tags.highway === 'footway' && pathFeature.tags.footway === 'sidewalk') { return {}; } - var pathFeature = entity1IsPath ? entity1 : entity2; 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 } : {}; @@ -435,6 +441,10 @@ export function validationCrossingWays(context) { if (connectionTags) { fixes.push(makeConnectWaysFix(this.data.connectionTags)); + let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true); + if (lessLikelyConnectionTags && JSON.stringify(connectionTags) !== JSON.stringify(lessLikelyConnectionTags)) { + fixes.push(makeConnectWaysFix(lessLikelyConnectionTags)); + } } if (isCrossingIndoors) { @@ -692,16 +702,21 @@ export function validationCrossingWays(context) { function makeConnectWaysFix(connectionTags) { var fixTitleID = 'connect_features'; + var fixIcon = 'iD-icon-crossing'; + if (connectionTags.highway === 'crossing') { + fixTitleID = 'connect_using_crossing'; + fixIcon = 'temaki-pedestrian'; + } if (connectionTags.ford) { fixTitleID = 'connect_using_ford'; + fixIcon = 'temaki-pedestrian'; } return new validationIssueFix({ - icon: 'iD-icon-crossing', + icon: fixIcon, title: t.append('issues.fix.' + fixTitleID + '.title'), onClick: function(context) { var loc = this.issue.loc; - var connectionTags = this.issue.data.connectionTags; var edges = this.issue.data.edges; context.perform(