From b2f8c161d9c5652fd7b996c19a0edbdc845592ff Mon Sep 17 00:00:00 2001 From: Andrew Harvey Date: Mon, 3 May 2021 09:11:12 +1000 Subject: credits for code snippet --- reduceOverlap.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'reduceOverlap.js') diff --git a/reduceOverlap.js b/reduceOverlap.js index eb91170..6cf4058 100755 --- a/reduceOverlap.js +++ b/reduceOverlap.js @@ -69,12 +69,14 @@ const reduce = new Transform({ // multiple non-unit features, unsure how to reduce } else { const nonUnitFeature = nonUnitFeatures[0] + // place all the other addr:unit into addr:flats const allOtherUnits = groupedFeatures.filter(f => 'addr:unit' in f.properties).map(f => f.properties['addr:unit']) // if allOtherUnits.length is one then that means we have one address without a unit and one with a unit at the same point // TODO should we just drop the non-unit address and keep the addr:unit one? + // adapted from https://stackoverflow.com/a/54973116/6702659 const sortedAllOtherUnitsAsRanges = allOtherUnits .slice() .sort((a, b) => a - b) @@ -102,6 +104,7 @@ const reduce = new Transform({ const feature = groupedFeatures[0] delete feature.properties['addr:unit'] + // adapted from https://stackoverflow.com/a/54973116/6702659 const unitRanges = units .slice() .sort((a, b) => a - b) -- cgit v1.2.3