Prevent using ways in the wrong direction
This commit is contained in:
parent
d42e3ed3ed
commit
b3de2e25f1
14
back/data.js
14
back/data.js
|
@ -78,7 +78,11 @@ out body qt;
|
||||||
|
|
||||||
for (let id of rawWays)
|
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)
|
if (type === 'way' && nodes.length >= 1)
|
||||||
{
|
{
|
||||||
|
@ -93,14 +97,16 @@ out body qt;
|
||||||
{
|
{
|
||||||
if (!nodeNeighbors.has(node))
|
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(node).add(previousNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeNeighbors.get(previousNode).add(node);
|
|
||||||
previousNode = node;
|
previousNode = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue