Repository navigation
Try GNW Horizon from the dataset drawer with a guided prompt - #5276
Merged
Merged
Conversation
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>
Merged
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.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
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:
tree-cover-losstree-cover-gain-5ytree-covertree-cover-loss-firestree-cover-loss-by-dominant-driverintegrated-deforestation-alerts-8bitnet-carbon-fluxLeft out on purpose:
land-cover(ESA/UCLouvain 2015 on GFW, GLAD-based in Horizon) andnatural-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 (withutm_source=gfw&utm_medium=map-datasets&utm_campaign=horizon-dataset-prompt). Returnsnullfor unsupported datasets.LayerToggletakes an optionalhorizonUrland 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).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 returnnull.next dev, Forest change tab): 5 of 13 rows show the link (integrated alerts, TCL due to fires, gain, TCL, TCL by driver), each withtarget="_blank"and the right prompt. Tree cover (Land cover tab) and net flux (Climate tab) use the same code path.