fix(street-level): deduplicate overlapping dateline tile halves

This commit is contained in:
Rudy Celekli committed 2026-10-14 14:17:56 -04:00
1 parent 6dd4d0156f
commit ba58a5ec50
4 files changed
+28 -1

No files matched your search

+2
View File
@@ -15,6 +15,8 @@
the five borough cores load and `CCTV_NYC_MAX_SOURCES` changes the cap. The catalog-wide ceiling is
unchanged; extra cameras share it round-robin with the other packs.
- Street Level requests count each tile once when dateline bounds overlap at coarse zoom levels.
- Treat explicitly current, complete empty vessel coverage as a successful update,
clearing obsolete contacts while retaining stale or incomplete snapshots.
+5
View File
@@ -5310,3 +5310,8 @@ 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(street-level): deduplicate overlapping dateline tile halves
Deduplicate tile addresses before ranking, truncating and reporting total coverage. Dateline ordering and the existing focus policy remain in control.
@@ -0,0 +1,15 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { tilesForBbox } from './tileMath.js';
test('coarse dateline coverage counts each tile exactly once', () => {
for (const z of [0, 1, 2]) {
const result = tilesForBbox([170, -1, -170, 1], z);
const keys = result.tiles.map((t) => `${t.x}/${t.y}/${t.z}`);
assert.equal(new Set(keys).size, keys.length);
assert.equal(result.total, keys.length);
const limited = tilesForBbox([170, -1, -170, 1], z, { limit: 1 });
assert.equal(limited.total, keys.length);
assert.equal(limited.truncated, keys.length > 1);
assert.equal(limited.tiles.length, 1);
}
});
+6 -1
View File
@@ -147,7 +147,12 @@ export function tilesForBbox(bbox, z, { limit = Infinity, focus = null } = {}) {
return Math.min(dx, n - dx) ** 2 + (tile.y - centre.y) ** 2;
};
// Each tile's distance is computed once; ties keep their row order.
const ranked = tiles
const unique = [
...new Map(
tiles.map((tile) => [`${tile.x}/${tile.y}/${tile.z}`, tile]),
).values(),
];
const ranked = unique
.map((tile) => ({ tile, d: distance2(tile) }))
.sort((a, b) => a.d - b.d)
.map(({ tile }) => tile);