aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/reduceOverlap.js11
-rwxr-xr-xbin/reduceRangeDuplicates.js2
-rw-r--r--lib/unitsToRanges.js2
3 files changed, 10 insertions, 5 deletions
diff --git a/bin/reduceOverlap.js b/bin/reduceOverlap.js
index 62ba10d..2255368 100755
--- a/bin/reduceOverlap.js
+++ b/bin/reduceOverlap.js
@@ -12,6 +12,10 @@ const argv = require('yargs/yargs')(process.argv.slice(2))
type: 'boolean',
description: 'Dumps full debug logs'
})
+ .option('verbose', {
+ type: 'boolean',
+ description: ''
+ })
.argv
if (argv._.length < 2) {
@@ -131,8 +135,8 @@ const reduce = new Transform({
}
this.push(featureGroup.filter(f => 'addr:unit' in f.properties)[0])
} else {
- nonUnitFeature.properties['addr:flats'] = unitsToRanges(allOtherUnits, featureGroup)
- // TODO should we set addr:flats:prefix from addr:unit:prefix?
+ const flats = unitsToRanges(allOtherUnits, argv.verbose && featureGroup)
+ nonUnitFeature.properties['addr:flats'] = flats
this.push(nonUnitFeature)
}
}
@@ -149,7 +153,8 @@ const reduce = new Transform({
const feature = cloneDeep(featureGroup[0])
delete feature.properties['addr:unit']
- feature.properties['addr:flats'] = unitsToRanges(units, featureGroup)
+ const flats = unitsToRanges(units, argv.verbose && featureGroup)
+ feature.properties['addr:flats'] = flats
this.push(feature)
}
} else if (featureGroup.length === 1) {
diff --git a/bin/reduceRangeDuplicates.js b/bin/reduceRangeDuplicates.js
index 11600b4..093d9bc 100755
--- a/bin/reduceRangeDuplicates.js
+++ b/bin/reduceRangeDuplicates.js
@@ -251,7 +251,7 @@ const reduceNonRange = new Transform({
}
}
} else {
- // no addr:unit on the feature to safe to drop
+ // no addr:unit or addr:flats on the feature to safe to drop
dropFeature = true
}
break
diff --git a/lib/unitsToRanges.js b/lib/unitsToRanges.js
index cd20e59..764d8f2 100644
--- a/lib/unitsToRanges.js
+++ b/lib/unitsToRanges.js
@@ -32,7 +32,7 @@ module.exports = (units, sourceAddresses) => {
// prefix/suffix don't match in the from-to, so just pass as is
console.log(`passed a range with different prefix/suffix: ${rangeParts[0]}-${rangeParts[1]}`)
if (sourceAddresses) {
- // console.log(JSON.stringify(sourceAddresses, null, 2))
+ console.log(JSON.stringify(sourceAddresses, null, 2))
}
acc.push(cur)
}