aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rwxr-xr-xbin/conflate.js35
-rwxr-xr-xbin/reduceOverlap.js2
3 files changed, 38 insertions, 3 deletions
diff --git a/README.md b/README.md
index d7dc902..ab02694 100644
--- a/README.md
+++ b/README.md
@@ -255,6 +255,10 @@ This produces outputs in `dist/conflate`:
4. `exactMatch` - `addr:housenumber` and `addr:street` match an existing address within the same block. These should be reviewed for import.
5. `noExactMatch` - the Vicmap addresses exists within a block with existing OSM addresses, however no exact match on the `addr:housenumber` and `addr:street` was found. This likely can be imported automatically, but may want to be manually reviewed.
+Some addresses in OSM are mapped with `addr:housenumber=unit/number`, in the conflation process where matched with a corresponding unit/number/street, then the OSM address is modified into `addr:unit=unit`, `addr:housenumber=number`.
+
+This is outputted as a MapRoulette challenge (`dist/conflate/mr_explodeUnitFromNumber.geojson`), however because we are confident in this change it isn't uploaded into MapRoulette, instead we further process this and upload it as `addrUnitFromHousenumber` in the import candidates.
+
These results are in GeoJSON format, for easier viewing in QGIS convert to FGB with:
make convertConflationResultsToFGB
diff --git a/bin/conflate.js b/bin/conflate.js
index c2eb813..3cbd11a 100755
--- a/bin/conflate.js
+++ b/bin/conflate.js
@@ -180,10 +180,41 @@ const conflate = new Transform({
// ignoring whitespace when comparing house numbers
// ignoring case
// ignoring differences between "Foo - Bar Street" and "Foo-Bar Street", these kinds of names are common in country victoria
- return feature.properties['addr:street'] && osmStreet
+ const isMatched = feature.properties['addr:street'] && osmStreet
&& feature.properties['addr:street'].toLowerCase().replaceAll(' - ', '-') === osmStreet.toLowerCase().replaceAll(' - ', '-')
&& osmHouseNumber !== null && feature.properties['addr:housenumber'].replaceAll(' ', '').toLowerCase() === osmHouseNumber.replaceAll(' ', '').toLowerCase()
&& (vicmapUnit === osmUnit)
+
+ // if matched but the match came from exploding X/Y into Unit X, Number Y, then automate this to be changed in OSM
+ if (isMatched && osmAddr.properties['addr:housenumber'].split('/').length > 1) {
+ // MapRoulette task
+ const task = {
+ type: 'FeatureCollection',
+ features: [ osmAddr ],
+ cooperativeWork: {
+ meta: {
+ version: 2,
+ type: 1 // tag fix type
+ },
+ operations: [{
+ operationType: 'modifyElement',
+ data: {
+ id: `${osmAddr.properties['@type']}/${osmAddr.properties['@id']}`,
+ operations: [{
+ operation: 'setTags',
+ data: {
+ 'addr:unit': osmUnit,
+ 'addr:housenumber': osmHouseNumber
+ }
+ }]
+ }
+ }]
+ }
+ }
+ outputStreams.mr_explodeUnitFromNumber.write(task)
+ }
+
+ return isMatched
})
if (matches.length) {
@@ -252,7 +283,7 @@ const conflate = new Transform({
})
// ndjson streams to output features
-const outputKeys = ['notFoundInBlocks', 'noExactMatch', 'exactMatch', 'exactMatchLines', 'mr_withinExistingOSMAddressPoly', 'withinExistingOSMAddressPoly', 'noOSMAddressWithinBlock']
+const outputKeys = ['notFoundInBlocks', 'noExactMatch', 'exactMatch', 'exactMatchLines', 'mr_explodeUnitFromNumber', 'mr_withinExistingOSMAddressPoly', 'withinExistingOSMAddressPoly', 'noOSMAddressWithinBlock']
const outputStreams = {}
const outputStreamOutputs = {}
diff --git a/bin/reduceOverlap.js b/bin/reduceOverlap.js
index 40b4708..90ca036 100755
--- a/bin/reduceOverlap.js
+++ b/bin/reduceOverlap.js
@@ -82,7 +82,7 @@ const reduce = new Transform({
// only one feature with this geometry, nothing to reduce, output as is
this.push(groupedFeatures[0])
} else {
- // mulitple features with the same geometry
+ // multiple features with the same geometry
// group by housenumber, street, suburb, state, postcode to reduce units into addr:flats
// groupedFeatures all all the features at the same point