From 750b4e023f27a77c5d626f2a03b125745a85bac5 Mon Sep 17 00:00:00 2001 From: Milos Brzakovic Date: Thu, 5 Aug 2021 14:50:38 +0200 Subject: [PATCH] crossing_ways fixing - specially handle crossing nodes --- modules/osm/node.js | 4 ++++ modules/validations/crossing_ways.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/osm/node.js b/modules/osm/node.js index 7b42197ff..92bde1f32 100644 --- a/modules/osm/node.js +++ b/modules/osm/node.js @@ -141,6 +141,10 @@ Object.assign(osmNode.prototype, { return utilArrayUniq(results); }, + isCrossing: function(){ + return this.tags.highway === 'crossing' || + this.tags.railway && this.tags.railway.indexOf('crossing') !== -1; + }, isEndpoint: function(resolver) { return resolver.transient(this, 'isEndpoint', function() { diff --git a/modules/validations/crossing_ways.js b/modules/validations/crossing_ways.js index ec38a7f82..3ab76d3be 100644 --- a/modules/validations/crossing_ways.js +++ b/modules/validations/crossing_ways.js @@ -721,7 +721,8 @@ export function validationCrossingWays(context) { var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])]; var nearby = geoSphericalClosestNode(edgeNodes, loc); // if there is already a suitable node nearby, use that - if (!nearby.node.hasInterestingTags() && nearby.distance < mergeThresholdInMeters) { + // use the node if node has no interesting tags or if it is a crossing node #8326 + if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) { nodesToMerge.push(nearby.node.id); // else add the new node to the way } else {