Data sources
Hydro stations and discharge
- SPARQL endpoint:
https://environment.ld.admin.ch/query - Graph:
<https://lindas.admin.ch/foen/hydro> - For each station, the query returns:
- Station URI and name
- River URI and name
- Latest discharge (via the FOEN hydro cube)
- Dive suitability thresholds (
ok_max,nogo_min) and alias names viaSERVICE <https://api.openstuff.ch/sparql> - Geometry WKT (
POINT(lon lat)) viageo:hasGeometry / geo:asWKT
Forest fire danger (regions)
- SPARQL endpoint:
https://environment.ld.admin.ch/query - Cube:
<https://environment.ld.admin.ch/foen/gefahren-waldbrand-warnung/1> - Graph:
<https://lindas.admin.ch/foen/gefahren-waldbrand-warnung> - For each forest fire warning region, the query returns:
- Region URI and ID (e.g.
https://ld.admin.ch/dimension/bgdi/biota/forestfirewarningregions/1805) - English region name
- Latest fire danger level ID (1–5) from the cube
- Canton URI, English canton name, and two‑letter abbreviation from
<https://lindas.admin.ch/territorial>and<https://lindas.admin.ch/fso/register> schema:validFromtimestamp of the latest observation
- Region URI and ID (e.g.
Region geometries (for spatial matching)
- GeoJSON is fetched from the geo.admin.ch MapServer:
https://api3.geo.admin.ch/rest/services/api/MapServer/ch.bafu.gefahren-waldbrand_warnung/{regionId}?geometryFormat=geojson&sr=4326 - Each response contains a single
Featurewith:geometry.type = "MultiPolygon"and its coordinates- Optional
bboxfor quick bounding‑box pre‑filtering - Properties such as
name_*,title_*,valid_from, andcanton, which are consistent with the cube data but are not relied on for logic
Client‑side logic
All logic runs in the browser; there is no server‑side code.
-
Fetch hydro stations
- Posts the hydro SPARQL query to
HYDRO_ENDPOINT. - Parses the JSON SPARQL results into station objects.
- Extracts and parses
station_geom_wktintolon/latusing a small WKTPOINTparser.
- Posts the hydro SPARQL query to
-
Fetch forest fire regions
- Posts the fire‑regions SPARQL query to
FIRE_ENDPOINT. - For each region, keeps:
regionId,regionName,levelId(1–5),cantonName,cantonAbbr, andvalidFrom.
- Posts the fire‑regions SPARQL query to
-
Fetch region geometries
- For each region ID, requests GeoJSON from the MapServer.
- Requests are parallelised with a small concurrency limit (default 8) to avoid overloading the service.
- Stores a map
regionId → { geometry, bbox }.
-
Spatial join: station → fire region
- For each station with valid
lon/lat:- Builds a point
[lon, lat]. - Iterates through regions:
- If a region has a
bbox, first checks if the point lies inside that box. - Runs a point‑in‑polygon test against the
MultiPolygongeometry: - Uses a standard ray‑casting algorithm for each linear ring.
- Outer ring must contain the point; inner rings (holes) must not.
- If a region has a
- On the first match, attaches a
fireobject to the station withregionId,regionName,levelId,cantonName,cantonAbbr, andvalidFrom.
- Builds a point
- For each station with valid
-
Dive suitability status
- Reuses the same logic as
stations-by-river.html: - Computes a status (
ok,caution,nogo,unknown) fromdischarge,okMax, andnogoMin. - Renders a coloured status dot with an explanatory tooltip.
- Reuses the same logic as
Rendering and UI
- Stations are grouped by
riverNameand sorted bystationName, as instations-by-river.html. - Each list entry shows:
- Dive status dot (if available).
- Link to
station-detail.html?station=…. - FOEN station link (
entry.stationUri) in parentheses. - Optional divesite aliases (“· Divesites: …”) from the assessment service.
-
A per‑station fire danger chip, if a forest fire region was matched, e.g.
· Fire: Low danger (SO).
-
Fire danger labels and colours follow the FOEN scale:
- Level 1 — Low danger —
#ccff66 - Level 2 — Moderate danger —
#ffff00 - Level 3 — Considerable danger —
#ff9900 - Level 4 — High danger —
#ff0000 - Level 5 — Very high danger —
#800000
- Level 1 — Low danger —
-
The fire danger chip has a tooltip such as:
Forest fire danger as of 2025-11-17T12:01:11+01:00 in Dorneck / Thierstein (SO)
Disclaimers
- Dive suitability: the suitability assessments are manually curated for some stations and are indicative only. Conditions can change rapidly; always assess on site and follow local regulations. No warranty; use at your own risk.
- Forest fire danger: values are derived from the FOEN forest fire warning dataset and linked to stations by spatial overlay in the browser. Official cantonal guidance always takes precedence; no warranty is given.