fix: bound large boxes by their farthest point on the sphere

A box's radius was the distance to its farthest corner, which falls short for
large boxes: a whole-world box measured about 10,000 km, so bike-share and
transit selection never considered systems beyond it. The radius now checks
whether the box holds the point opposite its center and otherwise samples
every edge.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:36 -07:00
1 parent e1ac5ac270
commit 4cfca57cfb
3 files changed
+64 -8

No files matched your search

+15
View File
@@ -481,3 +481,18 @@ test('traffic counts only roads inside a radius area and reports missing tiles',
assert.equal(partial.data.partial, true);
assert.match(partial.summary, /Some map tiles did not load/);
});
test('a whole-world bike-share search names every system it skipped', async () => {
const empty = { data: { stations: [] } };
const result = await composeCatalog({
tools: coreTools,
services: {
bikeshare: {
systems: GBFS_CITY_REGISTRY,
getStations: async () => empty,
},
},
}).call('get_bike_share', { area: { bbox: [-180, -90, 180, 90] } });
const named = [...result.data.systems, ...result.data.systems_not_searched];
assert.equal(named.length, GBFS_CITY_REGISTRY.length);
});