aboutsummaryrefslogtreecommitdiff
path: root/bin/conflate.js
diff options
context:
space:
mode:
authorAndrew Harvey <andrew@alantgeo.com.au>2021-07-05 23:41:35 +1000
committerAndrew Harvey <andrew@alantgeo.com.au>2021-07-05 23:41:35 +1000
commit9e3708dca0c07765ea047846fac0015c067308a2 (patch)
tree82ab801189141e189ee61603126c0dfff2501458 /bin/conflate.js
parent6a9a77e4860b9c64ee1fd6de86025268570696cb (diff)
fix reduce overlap where range is first
Diffstat (limited to 'bin/conflate.js')
-rwxr-xr-xbin/conflate.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/conflate.js b/bin/conflate.js
index a1b0b60..5af586c 100755
--- a/bin/conflate.js
+++ b/bin/conflate.js
@@ -15,6 +15,7 @@ const centroid = require('@turf/centroid').default
const booleanIntersects = require('@turf/boolean-intersects').default
const distance = require('@turf/distance').default
const { lcs } = require('string-comparison')
+const withinRange = require('../lib/withinRange')
const argv = require('yargs/yargs')(process.argv.slice(2))
.option('debug', {
@@ -191,7 +192,14 @@ const conflate = new Transform({
// ignoring differences between "Foo - Bar Street" and "Foo-Bar Street", these kinds of names are common in country victoria
const isMatched = feature.properties['addr:street'] && osmStreet
&& feature.properties['addr:street'].toLowerCase().replaceAll(' - ', '-').replaceAll('-', '') === osmStreet.toLowerCase().replaceAll(' - ', '-').replaceAll('-', '')
- && osmHouseNumber !== null && feature.properties['addr:housenumber'].replaceAll(' ', '').toLowerCase() === osmHouseNumber.replaceAll(' ', '').toLowerCase()
+ && osmHouseNumber !== null
+ && (
+ // housenumber can be an exact match
+ feature.properties['addr:housenumber'].replaceAll(' ', '').toLowerCase() === osmHouseNumber.replaceAll(' ', '').toLowerCase()
+ // or it can just intersect the range
+ // eg 182 St Georges Road Fitzroy North
+ || withinRange(feature, osmAddr, { checkStreet: false, checkHigherOrderAddrKeys: false })
+ )
&& (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