From a923c9f996926c7543a48c6f77783eb51af17173 Mon Sep 17 00:00:00 2001 From: Andrew Harvey Date: Wed, 9 Jun 2021 21:45:11 +1000 Subject: flag Vicmap complex data for manual maproulette review --- bin/vicmap2osm.js | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'bin/vicmap2osm.js') diff --git a/bin/vicmap2osm.js b/bin/vicmap2osm.js index 597043e..a45bc4e 100755 --- a/bin/vicmap2osm.js +++ b/bin/vicmap2osm.js @@ -40,6 +40,14 @@ if (!fs.existsSync(inputFile)) { process.exit(1) } +// output Vicmap complex name data +const complexStream = ndjson.stringify() +const complexStreamOutput = complexStream.pipe(fs.createWriteStream(`dist/vicmap-complex.geojson`)) + +// output Vicmap building name data +const buildingStream = ndjson.stringify() +const buildingStreamOutput = buildingStream.pipe(fs.createWriteStream(`dist/vicmap-building.geojson`)) + let sourceCount = 0 const transform = new Transform({ readableObjectMode: true, @@ -53,6 +61,17 @@ const transform = new Transform({ } } + if (feature.properties.COMPLEX) { + const complexFeature = { + type: 'Feature', + properties: { + name: feature.properties.COMPLEX + }, + geometry: feature.geometry + } + complexStream.write(complexFeature) + } + // convert source Feature into a Feature per the OSM schema const osm = toOSM(feature, { tracing: argv.tracing, @@ -60,6 +79,17 @@ const transform = new Transform({ includeDerivableProperties: argv.preserveDerivableProperties }) + if (feature.properties.BUILDING) { + const buildingFeature = { + type: 'Feature', + properties: Object.assign({}, osm.properties, { + name: feature.properties.BUILDING + }), + geometry: osm.geometry + } + buildingStream.write(buildingFeature) + } + // some addresses we skip importing into OSM, see README.md#omitted-addresses if (filterOSM(osm) && filterSource(feature)) { this.push(osm) @@ -81,7 +111,15 @@ pipeline( console.log(err) process.exit(1) } else { - process.exit(0) + complexStream.end() + buildingStream.end() + complexStreamOutput.on('finish', () => { + console.log(`saved dist/vicmap-complex.geojson`) + buildingStreamOutput.on('finish', () => { + console.log(`saved dist/vicmap-building.geojson`) + process.exit(0) + }) + }) } } ) -- cgit v1.2.3