From 4041ab48fe2d65ced7997b788915d430340cedde Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Thu, 29 Mar 2018 16:18:17 -0400 Subject: [PATCH] Only restriction along viaway can enter either at either end (closes #4951) Previously it would only count if the connecting node was the first one. I guess I was only thinking about oneways only the day I wrote that code. --- modules/osm/intersection.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/osm/intersection.js b/modules/osm/intersection.js index 75e23275d..72782043d 100644 --- a/modules/osm/intersection.js +++ b/modules/osm/intersection.js @@ -529,8 +529,10 @@ export function osmIntersection(graph, startVertexId, maxDistance) { if (v.length === 1 && v[0].type === 'node') { // via node isOnlyVia = (v[0].id === nextNode.id); } else { // via way(s) - for (k = 0; k < v.length; k++) { - if (v[k].type === 'way' && vgraph.entity(v[k].id).first() === nextNode.id) { + for (var i = 0; i < v.length; i++) { + if (!v[i].type === 'way') continue; + var viaWay = vgraph.entity(v[i].id); + if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) { isOnlyVia = true; break; }