diff --git a/src/stage2-preprocess/preprocessNZGB.ts b/src/stage2-preprocess/preprocessNZGB.ts index a657b74..488740f 100644 --- a/src/stage2-preprocess/preprocessNZGB.ts +++ b/src/stage2-preprocess/preprocessNZGB.ts @@ -34,7 +34,7 @@ type TempObject = { // these transformations must be kept to a bare minimum const transformName = (_nzgbName: string, type: NameType) => { - let nzgbName = _nzgbName.replace(/ pa$/i, ' Pā'); + let nzgbName = _nzgbName.trim().replace(/ pa$/i, ' Pā'); // for train stations, OSM doesn't include the suffix in the name if (type === 'Railway Station') { @@ -59,6 +59,9 @@ async function csvToTemp(): Promise<{ out: TempObject; ety: EtymologyReport }> { if (!(index % 1000)) process.stdout.write('.'); index += 1; + // "Discontinued" don't exist or completely irrelevant + if (data.status.endsWith('Discontinued')) return; + /** cause of the BOM character at the start of the csv file we do this */ const ref = +(data.name_id || data['\uFEFFname_id' as 'name_id']); diff --git a/src/stage3-conflate/compareFeatures/compareFeatures.ts b/src/stage3-conflate/compareFeatures/compareFeatures.ts index 7a77ac4..08a7c65 100644 --- a/src/stage3-conflate/compareFeatures/compareFeatures.ts +++ b/src/stage3-conflate/compareFeatures/compareFeatures.ts @@ -117,7 +117,9 @@ export function compareFeatures( const threshold = osm.osmId[0] === 'n' ? DISTANCE_APART_THRESHOLD_NODE - : DISTANCE_APART_THRESHOLD_AREA; + : osm.osmId[0] === 'w' + ? DISTANCE_APART_THRESHOLD_AREA + : Infinity; // relations are not checked for distance if (metresAway > threshold && !DONT_TRY_TO_MOVE.has(nzgb.type)) { tagChanges.__action = 'move'; } diff --git a/src/stage3-conflate/getPresetTags.ts b/src/stage3-conflate/getPresetTags.ts index d5245c2..99545d6 100644 --- a/src/stage3-conflate/getPresetTags.ts +++ b/src/stage3-conflate/getPresetTags.ts @@ -23,12 +23,12 @@ export function getPresetTags(place: NZGBFeature): { return { all: preset.subseaTags, match: preset.subseaTags, - acceptTags: preset.acceptTags, + acceptTags: [...(preset.acceptTags || []), preset.onLandTags], }; } return { all: preset.onLandTags, match: preset.onLandTags, - acceptTags: preset.acceptTags, + acceptTags: [...(preset.acceptTags || []), preset.subseaTags], }; }