Skip to content

Try GNW Horizon from the dataset drawer with a guided prompt - #5276

Merged
01painadam merged 3 commits into
developfrom
feat/horizon-dataset-prompt
Oct 14, 2026
Merged

01painadam merged 3 commits into
developfrom
feat/horizon-dataset-prompt

Conversation

@01painadam

@01painadam 01painadam commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

What

Adds an Explore with AI in Horizon ↗ link under each dataset in the map's dataset drawer that Horizon can analyse. It opens https://horizon.globalnaturewatch.org/app?prompt=… in a new tab. Horizon runs ?prompt= as the first chat message once the person has signed in (and accepted the terms, which keep the query string), so they land straight in a guided tutorial for that dataset.

Screenshot 2026-10-14 at 14 18 05

This is a test run of GFW to Horizon redirects, to see whether people follow the link and whether the tutorial prompt is a useful first conversation.

The prompt

This is a user tutorial: Add <Horizon dataset name> to the map and ask me what I'd like to analyse. Explain the analysis parameters available and then suggest analysing a country, e.g. Brazil, spelling out for the user how to form and send the prompt.

The prompt uses Horizon's own dataset name rather than the GFW one, so the agent picks the right dataset instead of a near match.

Which datasets get the link

Only the GFW datasets that have an exact Horizon counterpart:

GFW slug Horizon dataset
tree-cover-loss Tree cover loss
tree-cover-gain-5y Tree cover gain
tree-cover Tree cover
tree-cover-loss-fires Tree cover loss due to fires
tree-cover-loss-by-dominant-driver Tree cover loss by dominant driver
integrated-deforestation-alerts-8bit Integrated alerts
net-carbon-flux Forest greenhouse gas net flux

Left out on purpose: land-cover (ESA/UCLouvain 2015 on GFW, GLAD-based in Horizon) and natural-forests (only one class of Horizon's SBTN Natural Lands Map). Linking either would have Horizon swap in a different dataset.

Changes

  • utils/horizon-prompt.js: the slug to Horizon name map, the prompt and URL builder (with utm_source=gfw&utm_medium=map-datasets&utm_campaign=horizon-dataset-prompt). Returns null for unsupported datasets.
  • LayerToggle takes an optional horizonUrl and renders the link below the citation. Only the dataset drawer passes it, so the legend and search results are unchanged. Clicks fire a GA event (Map data / Open dataset in Horizon / slug).
  • The pre-commit prettier hook also reformatted two existing closing braces in LayerToggle.

Testing

  • utils/__tests__/horizon-prompt.spec.js (5 tests): URL shape, Horizon name in the prompt, prompt round-trips through the query string, unsupported slugs return null.
  • ESLint clean on all touched files.
  • Ran locally (next dev, Forest change tab): 5 of 13 rows show the link (integrated alerts, TCL due to fires, gain, TCL, TCL by driver), each with target="_blank" and the right prompt. Tree cover (Land cover tab) and net flux (Climate tab) use the same code path.

01painadam and others added 2 commits October 14, 2026 14:06
Maps the seven GFW datasets with an exact Horizon counterpart to
Horizon's own dataset names and builds a /app?prompt= link that starts
a guided tutorial conversation for that dataset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LayerToggle renders the link only when given a horizonUrl, so the legend
and search results are unchanged. Clicks are tracked under Map data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@willian-viana
willian-viana temporarily deployed to gfw-staging-pr-5276 October 14, 2026 12:52 Inactive

@willian-viana willian-viana left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@01painadam
01painadam merged commit 910a802 into develop Oct 14, 2026
4 checks passed
@01painadam
01painadam deleted the feat/horizon-dataset-prompt branch October 14, 2026 13:01
@willian-viana willian-viana mentioned this pull request Oct 15, 2026

This branch was previously deployed

1 inactive deployment
gfw-staging-pr-5276 — 47d27dda Deployed Oct 14, 2026 by willian-viana
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants