diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 967fbda64..4c33b1744 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -1429,6 +1429,8 @@ accessible name remains "Don't show this again". Control behavior is unchanged. ## FIRMS source status +FIRMS ingestion and adaptation require explicit finite coordinates within WGS84 ranges; genuine zero coordinates remain valid and admitted detection indices stay sequential. + The FIRMS proxy records source success after appending its rows. If aggregation throws, that source reports failure without a contradictory success entry. The existing per-record append continues to support large feeds; sequential @@ -5326,8 +5328,3 @@ datacenters, dams and the Nepal locator retain that shared credit while displaye Military fragments stitch by source identity. Different mapped parcels merge only when their footprints touch or contain one another, never across a seam tolerance gap. - - -### fix(firms): reject missing and out-of-range detection coordinates - -Require explicit numeric coordinate evidence and WGS84 ranges in both ingestion paths, preserving genuine zero coordinates and sequential admitted detection indices. diff --git a/src/data/firmsAdapt.js b/src/data/firmsAdapt.js index b8f07ec2d..3e3f27631 100644 --- a/src/data/firmsAdapt.js +++ b/src/data/firmsAdapt.js @@ -22,11 +22,8 @@ export function adaptFirmsRecords(records) { const lat = Number(record?.lat); const lon = Number(record?.lon); if ( - ![record?.lat, record?.lon].every( - (value) => - typeof value === 'number' || - (typeof value === 'string' && value.trim() !== ''), - ) || + !hasCoordinateValue(record?.lat) || + !hasCoordinateValue(record?.lon) || !Number.isFinite(lat) || !Number.isFinite(lon) || Math.abs(lat) > 90 || @@ -121,3 +118,10 @@ function finiteNumber(value) { const number = Number(value); return Number.isFinite(number) ? number : 0; } + +function hasCoordinateValue(value) { + return ( + typeof value === 'number' || + (typeof value === 'string' && value.trim() !== '') + ); +}