Added 4 new test cases for postal cities lookup using USA ZIP codes:
19087 = Wayne
34119 = Naples
08540 = Princeton
40047 = Mount Washington
All but the last one were already passing, I added a new src/data/USA.override.tsv file to ensure the last one is correct.
The 'overrides file' functionality is very useful in these cases where the community consensus from OSM was not clear (ie. in this case there are 14 entries for Louisville and 13 for Mount Washington).
There was only one existing example of use of the overrides file (for AUS) and that file was named incorrectly and also missing the placetype field, we never noticed because AUS isn't currently being loaded by default, but I fixed it anyway and added a test case for the day we decide to turn that on (commented out).
I noticed that there is some dedupe logic missing in the case where the canonical mapping and the override mapping both contain the same WOFID, so I've added that logic now and it's working great.
In the process I was reminded of the behaviour of the overrides file, if no "weight" field is specified then it defaults to Number.MAX_SAFE_INTEGER (ie a very. large number), this can be controlled by specifying that field in the TSV file, the dedupe logic mentioned above will sort the file by WEIGHT DESC and so the value with the highest weight will be chosen for the label and favoured in the case of a duplicate.
Added 4 new test cases for postal cities lookup using USA ZIP codes:
All but the last one were already passing, I added a new
src/data/USA.override.tsv
file to ensure the last one is correct.The 'overrides file' functionality is very useful in these cases where the community consensus from OSM was not clear (ie. in this case there are 14 entries for
Louisville
and 13 forMount Washington
).There was only one existing example of use of the overrides file (for
AUS
) and that file was named incorrectly and also missing the placetype field, we never noticed becauseAUS
isn't currently being loaded by default, but I fixed it anyway and added a test case for the day we decide to turn that on (commented out).I noticed that there is some dedupe logic missing in the case where the canonical mapping and the override mapping both contain the same WOFID, so I've added that logic now and it's working great.
In the process I was reminded of the behaviour of the
overrides
file, if no "weight" field is specified then it defaults toNumber.MAX_SAFE_INTEGER
(ie a very. large number), this can be controlled by specifying that field in the TSV file, the dedupe logic mentioned above will sort the file byWEIGHT DESC
and so the value with the highest weight will be chosen for the label and favoured in the case of a duplicate.