mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
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:
1 parent
5b73b70d19
commit
6f56c84b0b
4 files changed
+201
-5
No files matched your search
@@ -1,7 +1,12 @@
|
||||
/** Submarine cables and their landing points. */
|
||||
|
||||
import { defineTool, ToolError } from '../catalog.js';
|
||||
import { AREA_SCHEMA, areaContains, resolveArea } from '../area.js';
|
||||
import {
|
||||
AREA_SCHEMA,
|
||||
areaContains,
|
||||
lineTouchesArea,
|
||||
resolveArea,
|
||||
} from '../area.js';
|
||||
import { LIMIT_SCHEMA, capRows, countNoun } from '../results.js';
|
||||
|
||||
const ATTRIBUTION = '© TeleGeography — submarinecablemap.com (CC BY-NC-SA 3.0)';
|
||||
@@ -58,9 +63,7 @@ export const findSubmarineCables = defineTool({
|
||||
return false;
|
||||
return (
|
||||
!area ||
|
||||
cableLines(feature).some((line) =>
|
||||
line.some(([lon, lat]) => areaContains(area, { lat, lon })),
|
||||
)
|
||||
cableLines(feature).some((line) => lineTouchesArea(line, area))
|
||||
);
|
||||
})
|
||||
.map((feature) => ({
|
||||
|
||||
Reference in new issue
Block a user