From 65345c290668de2ffcdbfd714069af86637b6d94 Mon Sep 17 00:00:00 2001 From: Andrew Harvey Date: Wed, 26 May 2021 13:17:43 +1000 Subject: looser matching, ignoring some whitespace and case --- bin/conflate.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bin/conflate.js') diff --git a/bin/conflate.js b/bin/conflate.js index e89693e..770cc57 100755 --- a/bin/conflate.js +++ b/bin/conflate.js @@ -174,8 +174,13 @@ const conflate = new Transform({ : null ) - return feature.properties['addr:street'] === osmStreet - && osmHouseNumber !== null && feature.properties['addr:housenumber'].replaceAll(' ', '') === osmHouseNumber.replaceAll(' ', '') // ignoring whitespace when comparing house numbers + // see if street matches and housenumber matches + // ignoring whitespace when comparing house numbers + // ignoring case + // ignoring unit for the time being + // ignoring differences between "Foo - Bar Street" and "Foo-Bar Street", these kinds of names are common in country victoria + return (feature.properties['addr:street'].toLowerCase().replaceAll(' - ', '-') === osmStreet.toLowerCase().replaceAll(' - ', '-')) + && osmHouseNumber !== null && feature.properties['addr:housenumber'].replaceAll(' ', '').toLowerCase() === osmHouseNumber.replaceAll(' ', '').toLowerCase() && (('addr:unit' in feature.properties && osmUnit !== null) ? feature.properties['addr:unit'].replaceAll(' ', '') === osmUnit.replaceAll(' ', '') : true) }) if (matches.length) { -- cgit v1.2.3