Skip placeholder-coordinate postcodes (lat >= 90) in ONSPD import
ONS marks non-geographic postcodes (no grid reference) with a placeholder latitude of 99.999999. The "Latest Centroids" export shipped ~12,789 such rows, which were imported as real postcodes pointing at lat 99.99 and would poison nearest-station distance maths. Drop them at ingest, with a test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,13 @@ final class ImportPostcodes extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
// ONS marks non-geographic postcodes (no grid reference) with a
|
||||
// placeholder latitude of 99.999999 — drop them so they don't
|
||||
// poison nearest-station distance maths with a bogus location.
|
||||
if (abs((float) $lat) >= 90) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pcd = strtoupper(preg_replace('/\s+/', '', (string) $row[$columns[$pcdColumn]]));
|
||||
|
||||
if ($pcd === '' || strlen($pcd) < 5) {
|
||||
|
||||
Reference in New Issue
Block a user