diff --git a/back/data.js b/back/data.js index c0a306b..176879f 100644 --- a/back/data.js +++ b/back/data.js @@ -78,7 +78,11 @@ out body qt; for (let id of rawWays) { - const {type, nodes} = elements[id]; + const {type, nodes, tags} = elements[id]; + const canGoBackward = ( + tags.oneway !== 'yes' + || parseInt(tags['lanes:psv:backward'], 10) > 0 + ); if (type === 'way' && nodes.length >= 1) { @@ -93,14 +97,16 @@ out body qt; { if (!nodeNeighbors.has(node)) { - nodeNeighbors.set(node, new Set([previousNode])); + nodeNeighbors.set(node, new Set()); } - else + + nodeNeighbors.get(previousNode).add(node); + + if (canGoBackward) { nodeNeighbors.get(node).add(previousNode); } - nodeNeighbors.get(previousNode).add(node); previousNode = node; } }