From eb5b09132ec243ffe80fd594446b234d6268cabc Mon Sep 17 00:00:00 2001 From: Andrew Harvey Date: Thu, 20 May 2021 14:24:13 +1000 Subject: fix conflation issue due to out by one error --- bin/conflate.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bin/conflate.js') diff --git a/bin/conflate.js b/bin/conflate.js index cec1d83..09667c5 100755 --- a/bin/conflate.js +++ b/bin/conflate.js @@ -239,13 +239,14 @@ pipeline( // find the blocks it might intersect const candidateBlocks = blockIndex.search(...bbox(osmAddrPolygon)) + // then test if it actually intersects - const intersectingBlocks = candidateBlocks.map(candidateBlock => booleanIntersects(osmAddrPolygon, blocksByOSMAddr[candidateBlock])) + const intersectingBlocks = candidateBlocks.filter(candidateBlock => booleanIntersects(osmAddrPolygon, blocksByOSMAddr[candidateBlock])) for (const intersectingBlock of intersectingBlocks) { - if (!(intersectingBlock.id in osmAddrPolygonsByBlock)) { - osmAddrPolygonsByBlock[intersectingBlock.id] = [] + if (!((intersectingBlock + 1) in osmAddrPolygonsByBlock)) { + osmAddrPolygonsByBlock[intersectingBlock + 1] = [] } - osmAddrPolygonsByBlock[intersectingBlock.id].push(osmAddrPolygon) + osmAddrPolygonsByBlock[intersectingBlock + 1].push(osmAddrPolygon) } } -- cgit v1.2.3