aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Harvey <andrew@alantgeo.com.au>2021-05-07 22:50:42 +1000
committerAndrew Harvey <andrew@alantgeo.com.au>2021-05-07 22:50:42 +1000
commit2b2d1b6b7a6f0bcf19da8bc111884407ba2400bf (patch)
treea7ce7f8ed8c00771d0d8e82d2f3f2507a86e66eb
parentfad3f801a3dc1185779b8c7b8b9442811aaa1982 (diff)
limit addr:flats values to 255 chars
-rwxr-xr-xbin/reduceOverlap.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/reduceOverlap.js b/bin/reduceOverlap.js
index 06b7911..aa18125 100755
--- a/bin/reduceOverlap.js
+++ b/bin/reduceOverlap.js
@@ -5,6 +5,7 @@ const { Readable, Transform, pipeline } = require('stream')
const ndjson = require('ndjson')
const cloneDeep = require('clone-deep')
const unitsToRanges = require('../lib/unitsToRanges.js')
+const valueLimits = require('../lib/valueLimits.js')
const argv = require('yargs/yargs')(process.argv.slice(2))
.option('debug', {
@@ -168,6 +169,26 @@ const reduce = new Transform({
}
})
+/**
+ * limit values
+ */
+let limitValuesIndex = 0
+const limitValues = new Transform({
+ readableObjectMode: true,
+ writableObjectMode: true,
+ transform(feature, encoding, callback) {
+ limitValuesIndex++
+ if (!argv.quiet) {
+ if (limitValuesIndex % 10000 === 0) {
+ process.stdout.write(` ${limitValuesIndex / 1000}k / ${Math.round(sourceCount / 1000)}k (${Math.round(limitValuesIndex / sourceCount * 100)}%)\r`)
+ }
+ }
+ this.push(valueLimits(feature))
+
+ callback()
+ }
+})
+
const debugKeys = ['multipleNonUnit', 'oneUnitOneNonUnit', 'sameGeometry']
const debugStreams = {}
const debugStreamOutputs = {}
@@ -195,6 +216,7 @@ pipeline(
pipeline(
Readable.from(Object.keys(features)),
reduce,
+ limitValues,
ndjson.stringify(),
fs.createWriteStream(outputFile),
err => {