diff options
author | Andrew Harvey <andrew@alantgeo.com.au> | 2021-05-03 09:11:12 +1000 |
---|---|---|
committer | Andrew Harvey <andrew@alantgeo.com.au> | 2021-05-03 09:11:12 +1000 |
commit | b2f8c161d9c5652fd7b996c19a0edbdc845592ff (patch) | |
tree | e4842af9c33b142e2568ce2d5dc94b6b63257845 /reduceOverlap.js | |
parent | 9ab19b5256a2fe0b80e15434233ed1c4079f3d33 (diff) |
credits for code snippet
Diffstat (limited to 'reduceOverlap.js')
-rwxr-xr-x | reduceOverlap.js | 3 |
1 files changed, 3 insertions, 0 deletions
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) |