fix: find cables that cross an area between vertices

Cable searches only tested vertices, so a cable crossing an area with no
vertex inside it was missed. Lines now test each segment against the area's
bounds, across the antimeridian too, and against a radius area's great-circle
distance.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:36 -07:00
1 parent 5b73b70d19
commit 6f56c84b0b
4 files changed
+201 -5

No files matched your search

+15
View File
@@ -72,6 +72,21 @@ test('cables are found by area and name, with landing points and attribution', a
catalog.call('find_submarine_cables', {}),
/area, a name or both/,
);
// Areas a cable crosses between vertices, including at the antimeridian.
const atlantic = await catalog.call('find_submarine_cables', {
area: { bbox: [-30, 40, -20, 43] },
});
assert.deepEqual(
atlantic.data.rows.map((row) => row.id),
['marea'],
);
const pacific = await catalog.call('find_submarine_cables', {
area: { bbox: [179, 34, -179, 35.5] },
});
assert.deepEqual(
pacific.data.rows.map((row) => row.id),
['unity'],
);
});
test('the local fetch serves bundled data files and nothing outside them', async () => {