diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-01-10 12:49:55 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 13:02:39 +0100 |
commit | 39da77aa0351b2c207310acc3eb5b20450019b70 (patch) | |
tree | 7fc1c6658adcd705971b76f551e651de3b13dca3 /tools | |
parent | 0529cc0a1697c78996c4f41971d6cfbdbed9bae2 (diff) | |
download | nevsky-39da77aa0351b2c207310acc3eb5b20450019b70.tar.gz |
Fix adjacency data with multiple ways between same locales.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gendata.js | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/tools/gendata.js b/tools/gendata.js index 0a1f5b4..c671cf6 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -307,15 +307,20 @@ locales.forEach(loc => { loc.adjacent = [] loc.adjacent_by_trackway = [] loc.adjacent_by_waterway = [] - for (let [to, way] of loc.ways) { - if (!loc.adjacent.includes(to)) - loc.adjacent.push(to) - if (ways[way].type === "trackway") - if (!loc.adjacent_by_trackway.includes(to)) - loc.adjacent_by_trackway.push(to) - if (ways[way].type === "waterway") - if (!loc.adjacent_by_waterway.includes(to)) - loc.adjacent_by_waterway.push(to) + for (let data of loc.ways) { + let to = data[0] + for (let i = 1; i < data.length; ++i) { + let way = data[i] + console.log("WAY", loc.name, to, way) + if (!loc.adjacent.includes(to)) + loc.adjacent.push(to) + if (ways[way].type === "trackway") + if (!loc.adjacent_by_trackway.includes(to)) + loc.adjacent_by_trackway.push(to) + if (ways[way].type === "waterway") + if (!loc.adjacent_by_waterway.includes(to)) + loc.adjacent_by_waterway.push(to) + } } loc.adjacent.sort(cmpnum) loc.adjacent_by_trackway.sort(cmpnum) |