aboutsummaryrefslogtreecommitdiff
path: root/bin/vicmap2osm.js
diff options
context:
space:
mode:
authorAndrew Harvey <andrew@alantgeo.com.au>2021-06-09 21:45:11 +1000
committerAndrew Harvey <andrew@alantgeo.com.au>2021-06-09 21:45:11 +1000
commita923c9f996926c7543a48c6f77783eb51af17173 (patch)
tree730441a8724d39e5f17ed98d0a36e0bf3f136b58 /bin/vicmap2osm.js
parent73b447f31e78978849524bacf31d2a2a1c56d293 (diff)
flag Vicmap complex data for manual maproulette review
Diffstat (limited to 'bin/vicmap2osm.js')
-rwxr-xr-xbin/vicmap2osm.js40
1 files changed, 39 insertions, 1 deletions
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)
+ })
+ })
}
}
)