Skip to content

Commit

Permalink
respect existing alt_addr:housenumber tags if LINZ has no data
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yle committed Jul 18, 2024
1 parent ab10d8d commit df61e36
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/__tests__/mock/linz-dump.csv
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,4 @@
,3000195,,Road,,193,A,,,,Oakleigh,,193A,Example Street,,,,,,,,,,,174.195,-36.9
,3000196,,Road,,193,B,,,,Oakleigh,,193B,Example Street,,,,,,,,,,,174.196,-36.9
,70197,,Road,,197,,,,,Oakleigh,Jericho,197,Example Street,,,,,,,,,,,176.197,-36.9
,70198,,Road,,198,A,,,,Oakleigh,,198A,Example Street,,,,,,,,,,,174.198,-36.9
9 changes: 9 additions & 0 deletions src/__tests__/mock/planet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,15 @@
<tag k="ref:linz:address_id" v="70197" />
</node>

<!-- unexpected `alt_addr:housenumber` tag -->
<node id="198" version="1" changeset="1" lat="-36.9" lon="174.198" user="" uid="0" visible="true" timestamp="2012-05-19T11:22:33Z">
<tag k="addr:housenumber" v="198A" />
<tag k="alt_addr:housenumber" v="1/198" />
<tag k="addr:street" v="Example Street" />
<tag k="addr:hamlet" v="Oakleigh" />
<tag k="ref:linz:address_id" v="70198" />
</node>

<!-- <ways> -->
<way id="31" version="1" changeset="1" user="" uid="0" visible="true" timestamp="2012-05-19T11:22:33Z">
<nd ref="28" />
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/snapshot/stats.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"date": "MOCK",
"count": {
"PERFECT": 19,
"PERFECT": 20,
"EXISTS_BUT_WRONG_DATA": 34,
"EXISTS_BUT_NO_LINZ_REF": 5,
"MULTIPLE_EXIST_BUT_NO_LINZ_REF": 1,
Expand All @@ -16,5 +16,5 @@
"NEEDS_DELETE_ON_BUILDING": 1,
"REPLACED_BY_BUILDING": 1
},
"total": 129
"total": 130
}
4 changes: 3 additions & 1 deletion src/conflate/processWithRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export function processWithRef(
: 0;

const houseOk = linzAddr.housenumber === osmAddr.housenumber;
const altHouseOk = linzAddr.housenumberAlt === osmAddr.housenumberAlt;
const altHouseOk = linzAddr.housenumberAlt
? linzAddr.housenumberAlt === osmAddr.housenumberAlt
: true; // if LINZ has no data, respect the existing tag value in OSM
const streetOk = linzAddr.street === osmAddr.street;
const suburbOk = linzSuburb === osmSuburb;
const townOk = // addr:city is only conflated if the tag already exists
Expand Down

0 comments on commit df61e36

Please sign in to comment.