fix: find fire perimeters that overlap an area

Fire perimeters were placed at their average vertex, so a fire enclosing the
whole requested area was missed. Polygons now count when a vertex is inside
the area, an edge crosses it, or the polygon contains it outside any hole.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:36 -07:00
1 parent 4af15aa6a9
commit dd8ba562d2
4 files changed
+88 -1

No files matched your search

+29
View File
@@ -665,3 +665,32 @@ test('brief sections use a named place at its own point', async () => {
assert.deepEqual(queries[0], { latitude: 35.6769, longitude: 139.7639 });
assert.match(result.data.sections.aircraft.summary, /in Tokyo, Japan\.$/);
});
test('a fire perimeter enclosing the whole area is found', async () => {
const perimeters = {
getSnapshot: async () => [
{
stableId: 'big',
name: 'Big Fire',
acres: 250000,
polygons: [
[
[
[-122, 38],
[-120, 38],
[-120, 40],
[-122, 40],
],
],
],
},
],
};
const result = await catalogWith({ perimeters }).call('get_fire_perimeters', {
area: { bbox: [-121.2, 38.9, -120.8, 39.1] },
});
assert.deepEqual(
result.data.rows.map((row) => row.id),
['big'],
);
});