mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat: return the view that shows each answer
Tool answers with something to show now include data.view: the view with the matching layers on, the area framed from above or a single aircraft or satellite followed, and the link that opens it. Area framing moves to src/tools/views.js so links and answers frame alike.
This commit is contained in:
1 parent
96a8a9addb
commit
d6473b6049
20 files changed
+393
-34
No files matched your search
@@ -1,5 +1,6 @@
|
||||
/** The bundled Bhote Koshi 2026 outburst flood event pack. */
|
||||
|
||||
import { suggestView } from '../views.js';
|
||||
import { BHOTE_KOSHI_FLOOD_PATH } from '../../data/bhoteKoshiFloodPath.js';
|
||||
import { defineTool, ToolError } from '../catalog.js';
|
||||
import { distanceKm } from '../area.js';
|
||||
@@ -26,6 +27,18 @@ function pathLengthKm(path) {
|
||||
|
||||
const pathPoint = ([lon, lat]) => ({ lat, lon });
|
||||
|
||||
/** The box around a `[lon, lat]` path, as an area to frame. */
|
||||
function pathArea(path) {
|
||||
const lons = path.map(([lon]) => lon);
|
||||
const lats = path.map(([, lat]) => lat);
|
||||
return {
|
||||
west: Math.min(...lons),
|
||||
south: Math.min(...lats),
|
||||
east: Math.max(...lons),
|
||||
north: Math.max(...lats),
|
||||
};
|
||||
}
|
||||
|
||||
function evidenceRow(record) {
|
||||
return {
|
||||
sequence: record.sequence ?? null,
|
||||
@@ -88,6 +101,10 @@ export const getBhoteKoshiFlood = defineTool({
|
||||
(args.phase ? ` in the ${args.phase} phase` : '') +
|
||||
` along a ${lengthKm} km mapped flood path.`,
|
||||
data: {
|
||||
view: suggestView(services, {
|
||||
area: pathArea(BHOTE_KOSHI_FLOOD_PATH),
|
||||
layers: ['bhote-koshi-2026'],
|
||||
}),
|
||||
id: event.id,
|
||||
title: event.title,
|
||||
observed_date: event.observedDate,
|
||||
|
||||
Reference in new issue
Block a user