# Seifur v5 — Babylon.js

Live: https://seifur.vedrid.is/v5/

[Download v5 source](assets/seifur-v5-imagery-source.tar.gz) (dependencies, raw GIS cache and the large generated satellite tile pyramid excluded; use the hosted imagery assets or rebuild them as described below).

A browser-native Babylon.js version of the initial Unreal v4 concept. The scene runs on the visitor's device using WebGPU where initialization succeeds, with WebGL fallback. It needs no Unreal build, Pixel Streaming or GPU server. Root production and earlier versions are unchanged.

## Included

- An Iceland elevation mesh built from ÍslandsDEM, with 75 simplified IS 50V land polygons including offshore islands.
- Google Maps-style mouse and touch pan, anchored zoom, rotation and tilt; country reset, top-down view and fullscreen where the browser supports it.
- Measured station wind, gust, temperature and precipitation colors, station search, selection and exact latest-observation details.
- Animated wind trails driven by the existing Seifur interpolated vector field. Gust colors use gust metadata while motion continues to use sustained wind vectors.
- Temperature and precipitation field colors on the terrain, with missing cells retaining terrain colors.
- Quality controls, adjustable terrain height scale, pause and reduced-motion support.
- Current timestamps, stale and missing-data handling, field coverage and source attribution.
- Automatic imagery: locally hosted Sentinel in overview and Google detail only beyond Sentinel’s native resolution.
- The official IS 50V gazetteer, with approximately 200,000 searchable names, scale-dependent labels, Icelandic search normalization and place details.
- Six root-production road layers: conditions, alerts, cameras, winter service, weight restrictions and traffic. Search roads, cameras and counters; select lines or map icons for details. Camera frames load only when opened; traffic details include direction, last 15 minutes, today, average speed and seven daily totals.

## Weather meaning

Station points use the station discovery snapshot; selecting a station separately requests `/api/observations-latest.php` to confirm its latest measurements. Values are measurements, not forecasts. Missing values remain blank; zero remains a real reading. Readings older than 30 minutes or marked stale by the server are presented as older data. Gray points indicate stale or missing values for the selected layer.

Wind, temperature and rain fields come from `/api/seifur-field.php` with a 64×48 grid and south-to-north row order. These are interpolated current fields, distinct from station truth. The server's wind field can include a background field, especially offshore. It is not a terrain CFD calculation. Displayed wind-trail motion is exaggerated for visibility and does not represent literal travel time. Gusts affect color/intensity, not the movement vector. Wind and gusts are one combined selectable layer. Wind-colored trail bodies and brighter gust-colored forward tips render concurrently, with separate 0–25 m/s wind and 0–35 m/s gust legends. Both use sustained-wind vectors for direction/motion. Missing gust values suppress only gust tips, preserving valid wind trails; missing wind-speed scalars suppress only wind colors. Missing vectors suppress both directional marks. Temperature/rain modes and zoom decluttering hide both wind/gust renderers together. A stale field stops animating and stops tinting the terrain.

Precipitation can have different measurement periods and classifications between providers; it is not a uniform rain-rate field. Field colors should be interpreted with the displayed coverage and timestamps.

Both weather requests refresh every 60 seconds while visible. Hidden pages stop the render loop and resume/refetch when visible. Failed requests preserve dated data; they never produce fabricated station readings.

## Satellite imagery, aerial photos and place names

The background automatically uses locally hosted **Copernicus Sentinel-2 Level 3, July–September 2025** imagery in overview. Google Map Tiles are requested only when the view needs finer than the mosaic’s native **10 m per pixel** detail. This threshold uses CSS viewport size and camera projection, independently of render-quality settings. There are no provider, satellite/hybrid or elevation-only background controls. Zooming out immediately returns to Sentinel and cancels queued Google work. Google acquisition dates vary by location and are not inferred from copyright years. Both sources share the same terrain, weather overlays and official gazetteer.

Google viewport metadata must confirm availability of finer detail than Sentinel; coarser Google coverage is skipped. Sentinel remains underneath while detail loads and when Google is unavailable. Google requests fetch only the selected detail zoom, with already loaded Google parents reused; national/intermediate Google tiles are not requested. `?imagery=sentinel` remains an unadvertised QA override to prevent billed requests during unrelated deep-zoom browser tests; it is not a user-facing background selector. The default route always uses the automatic policy.

The open satellite alternative uses 10 m source bands. Its quarterly cloud-masked composite is historical imagery, not live snow cover or a single acquisition date. The summer quarter was selected for Iceland's seasonal visibility. Source: [ESA/CDSE documentation](https://documentation.dataspace.copernicus.eu/Data/Sentinel2.html), with public COG access through [Taylor Geospatial / Source Cooperative](https://source.coop/tge-labs/sentinel-2-quarterly-cloudless-mosaics).

The local derivative uses B04/B03/B02, a fixed reflectance display transform, WGS84 reprojection and a WebP tile pyramid. It preserves actual imagery rather than generating artificial landscape textures. Source resolution and displayed resolution differ: country views use small overview tiles; detail increases as the camera approaches. The finest pyramid has 65,536 samples over the 12° × 4° app extent, which slightly oversamples the native 10 m data at Icelandic latitudes. Oversampling adds no physical detail. Missing pixels remain transparent over the terrain.

The previously imported NÁTT aerial coverage and its importer are retained as source assets, but the automatic background no longer requests or displays that WMS layer. The active imagery path is Sentinel → Google as detail is needed.

Imagery triangles are clipped from the same existing terrain mesh. This avoids conflicting elevation surfaces between detail levels. Parent images remain until children are ready, unused textures are evicted, and phone concurrency is lower. Imagery failure preserves the terrain, weather and road layers. The height mesh remains the approximately 2.4 km national overview mesh described below; imagery detail does not change its geometry. Close-up navigation is consequently limited by that terrain. Weather temperature/rain fields tint the photo layer, while wind/gust trails retain their existing meaning. Imagery strength is fixed at 100%; there is no opacity slider.

Place names come from **IS 50V Örnefni, edition 12 November 2026**, not a manually invented list. The importer validates the complete 200,674-feature WFS response and retains **200,482 names within the application's bounding box**. Point positions are retained; polygon anchors use an interior point and line anchors use the halfway point, so labels are display anchors rather than surveyed point features. Labels are decluttered and increase with zoom; all retained names remain searchable. Search accepts Icelandic diacritics and forms such as `thorsmork` for `Þórsmörk`. Duplicate names in different locations retain their separate identities. [Official gazetteer](https://www.natt.is/is/midlun/kortagogn/ornefni), [local provenance](assets/PLACES-PROVENANCE.json), CC BY 4.0.

Open satellite attribution: **Contains modified Copernicus Sentinel data 2025** (ESA/CDSE; mirror: Taylor Geospatial / Source Cooperative), plus **Náttúrufræðistofnun: Grunnkort Loftmynd, ÍslandsDEM, IS 50V Örnefni and Strandlína**, CC BY 4.0. The [Copernicus legal notice](https://sentinels.copernicus.eu/documents/247904/690755/Sentinel_Data_Legal_Notice) permits this imagery derivative. Full satellite period, processing and source URLs are in [the imagery manifest](assets/imagery/manifest.json).

### Map-first layout and phones

The main viewer has no page header or marketing heading. Its map fills the visible viewport, starts centered over Iceland, and keeps both desktop and mobile settings closed initially. Floating **Kortlög** and **Leita** buttons open the controls and official-place search. Renderer diagnostics, data status and source links live inside settings. The four main map controls and north reset stay on the map; pause/fullscreen controls are in settings.

Portrait phones use a settings sheet and bounded detail cards at the bottom, leaving the upper map available. Landscape and short screens use a narrow side panel instead. Cards scroll independently and keep their close control available. Selecting a feature, choosing a search result, opening/closing a card and refreshing observations leave the camera center, zoom, heading, tilt and projection unchanged. Selection only highlights the feature and opens its data. Camera navigation is controlled explicitly through map gestures and navigation buttons. Touch targets for navigation/settings are at least 44 px; search fields use 16 px text to avoid focus zoom. The map follows `visualViewport` height changes and safe-area insets, including space for source/Google attribution. Google attribution height is measured so cards can stay above it. Selecting a search result closes the settings sheet; a pointer press on the map dismisses settings without blocking the map gesture.

`node v5/tests/layout-browser.cjs` checks full-map bounds, absent header, reachable controls, settings/search, nearby details, retained close controls and overflow on desktop, 390 px and 320 px portrait phones and 844×390 landscape. It also simulates a shortened visual viewport to check keyboard-height handling. Physical phone/browser keyboard behavior remains unverified here.

`node v5/tests/selection-browser.cjs` verifies that map/feature clicks, place/station/road search results, related-data links, card closure and background data refresh preserve the complete camera state and a projected map reference point on desktop and touch phones. It also verifies that the explicit zoom control remains functional.

### Map gestures

The Babylon viewer uses dedicated map inputs rather than the default orbit controls. Drag with the left mouse button or one finger to pan. Wheel/trackpad scroll, trackpad pinch, a double-click or a double-tap zoom around the pointer/touch position. Ctrl/Cmd/Shift plus mouse drag, or right drag, changes heading and tilt. With two fingers, pinch changes zoom, a deliberate twist changes heading and a parallel vertical swipe changes tilt; horizontal movement pans. A 4% change in finger separation locks the gesture to zoom until the fingers lift, ignoring angular wobble even if zoom direction reverses. Rotation requires an 18° deliberate twist with fingertips initially at least 40 px apart; its activation threshold is consumed without a heading jump. Rotation then follows the fingers in the same visible direction and keeps zoom fixed. The compass uses the same rotation direction as the rendered map. Safari trackpad gesture events use the same intent lock. Double-tap and hold the second touch, then drag down/up, to zoom in/out with one finger. A quick two-finger tap zooms out. The compass resets north and tilt without moving the selected map center. Focused-map arrow keys pan, modified arrows rotate/tilt, and plus/minus zoom.

Map gestures also work when a drag starts over a place label or road marker. Moving a pointer suppresses accidental feature selection; cards and settings retain their normal scrolling. Pointer cancellation, lost capture, window blur and backgrounding clear active gestures. Pinch/rotation events from Safari trackpads are handled separately from Ctrl+wheel pinch on Chromium. Zoom and pan use ray intersections with the horizontal plane through the camera target; elevated terrain can differ slightly from that anchor. The custom renderer does not claim identical Google camera animation or inertia.

The control conventions follow the official [Google vector-map mouse/keyboard guidance](https://developers.google.com/maps/documentation/javascript/vector-map) and [Google touch gesture guidance](https://developers.google.com/maps/documentation/android-sdk/controls). `node v5/tests/gestures-browser.cjs` exercises mouse and Chromium touch input on the live viewer using open imagery. Mouse and CDP touch tests verify left/one-finger pan, anchored wheel zoom, modified/right-drag rotation and tilt, keyboard controls, compass reset, label drag versus tap, pinch, twist, parallel tilt, two-finger tap zoom-out, double-tap, one-finger double-tap drag, panel scrolling and recovery after touch cancellation. Tap sequences supply native event timestamps so software rendering delays do not change the intended human gesture timings. Physical Safari/iOS and Android gesture feel still requires device testing.

`node v5/tests/pinch-browser.cjs` verifies zoom in/out with angular wobble, zoom reversal with a large twist, ignored small twists, actual projected map rotation clockwise/counterclockwise, matching compass direction, and the alternate Safari event path. The Safari event path is simulated, not a physical Safari device test. `tests/gesture.test.js` covers intent thresholds and gesture locking.

`node v5/tests/place-dismiss-browser.cjs` checks mouse/touch outside dismissal, inside-card interactions, selecting a different label, working related-station buttons, late-response cancellation and unchanged camera state.

`node v5/tests/wind-gust-browser.cjs` verifies the single combined control, simultaneous wind/gust rendering, joint mode switching, missing-gust handling and stale-field suppression.

### Your location and automatic follow

The viewer starts one browser `watchPosition` request on opening, with high accuracy, a five-second cache allowance and a 20-second acquisition timeout. The browser asks the visitor for permission when needed. The first fresh fix inside the Iceland map centers the camera and zooms to a local view; lower-accuracy fixes get a wider view. Later fixes update the compact elf avatar and camera target while preserving zoom, heading and tilt. Selecting map features still does not move the camera by itself.

The location marker is a locally drawn, transparent 28×34 px SVG elf with a moss-green cloak and cap, pale outline and a tiny blue position dot at its feet. It has no large circular badge or halo. The foot dot anchors the location; the marker remains constant in CSS pixels and lets pointer gestures pass through. Older positions desaturate the elf and mute the dot.

The location button toggles follow. Manual map navigation pauses camera following while the avatar continues tracking position; pressing the button resumes following. Settings include **Slökkva á staðsetningu**, which clears the watch, avatar and in-memory fix. Watches are suspended when hidden/page-hidden and resume when visible again if still enabled. Browser permission denial, unavailable location, unsupported APIs and out-of-Iceland fixes leave the map usable. The avatar is marked as last-known when no fresh fix is available; accuracy and update time appear in settings. Browser background/screen-lock behavior means the site cannot promise live updates while closed, hidden or suspended.

This implementation keeps only the latest fix in page memory and adds no coordinate storage, history or location-upload endpoint. Map navigation still requests the chosen provider's tiles for the visible area. Browser/OS geolocation-provider behavior remains controlled by the visitor's browser and permission settings. References: [Geolocation watchPosition](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition), [W3C Geolocation](https://www.w3.org/TR/geolocation/).

`node v5/tests/location-browser.cjs` checks automatic requests, native Chromium geolocation updates, initial zoom/avatar, moving follow without camera rotation, manual pause and resume, stop/clear, denied permission, unsupported APIs and out-of-coverage locations on desktop and phone emulation. `tests/location.test.js` checks fix validation, age, coverage and accuracy-dependent initial scale. Physical device GPS, permission prompts and background behavior still require device testing.

### Station name labels

Weather stations use the same 13 px name typography and text shadow as official place names, with a small anemometer icon and an explicit accessible name beginning “Veðurstöð”. Names come from the existing station feed; inactive/invalid-coordinate stations are excluded. Nearby labels share collision space with gazetteer names and road markers. Selected stations take priority, followed by stations with recent observations; national views cap station names to leave room for place names. More station names can appear at closer zoom levels.

Clicking a name or its sensor icon opens the existing station card and latest observation without moving the map. Dragging over a station label pans normally, while keeping the label DOM attached for pointer capture. Station labels update with station-feed refreshes and remain available if the gazetteer fails or official-place names are hidden. Their small visible badges have expanded touch areas; the existing color-coded station dots still represent weather readings.

`node v5/tests/station-labels-browser.cjs` verifies station text/icon distinction, shared typography, collision avoidance, station selection without camera movement, independent place-name toggling, refreshed station names, mouse/touch dragging and station labels during a gazetteer outage.

### Nearby weather and roads for place names

Clicking a map label or selecting a gazetteer search result opens the place card with the nearest active weather station and nearest available road segment. Station selection uses geographic distance, including stations with missing or older readings. Road selection checks every edge of the complete source line, before display simplification, rather than comparing road midpoints. Distances are approximate straight-line distances from the published place-label point, not driving routes or distances to the boundary of a named area.

The card fetches the chosen station’s latest observation through the existing root API, shows wind, gusts, temperature, rainfall and observation time, and retains dated station-list readings if that request fails. Missing values stay missing and stale readings remain marked. The road summary shows condition, its update time, winter service, weight restrictions and associated active notices. Buttons open the existing station and road detail cards. A pointer press outside the place card dismisses it without moving the camera or blocking the map/control interaction; presses inside the card keep its content and controls usable. Closing also invalidates pending nearby-observation responses so late data cannot reopen it. Selected place context updates when station/road data arrives or refreshes; late observation responses cannot overwrite another selected place. An empty or failed source gets an explicit unavailable message.

`node v5/tests/nearby-browser.cjs` checks map-label selection, geographic/line matching, exact observations and zero readings, detail buttons, rapid place changes and missing-source behavior on desktop and phone viewports using deterministic API fixtures. `tests/nearby.test.js` checks high-latitude distances, full source geometry, segment interiors/endpoints and invalid/missing inputs.

### Google Maps and OpenStreetMap assessment

- **Google Maps JavaScript API:** suitable for a separate Google-rendered satellite/hybrid/3D view, rather than extracting its imagery into Babylon textures. A browser API key must be restricted to the intended website and APIs. The user's billing account is in Iceland/EEA. A separate [Google satellite/hybrid comparison view](google/) is available when a distinct website-restricted browser key is configured; the current IP-restricted tile key is intentionally withheld from that view. Google 3D is offered where the device supports it, with return to the working 2D view after an initialization error.
- **Google Map Tiles API:** enabled and verified for the user's configured project, including actual Iceland roadmap and satellite image responses, plus a valid 3D tileset root. This integration uses satellite imagery; it does not yet render photogrammetric 3D buildings. The [EEA adjustments](https://developers.google.com/maps/comms/eea/map-tiles) still apply to projects covered by them; availability in this project is not a promise about other accounts. The app uses official API endpoints rather than unofficial Google imagery URLs.
- **Google Air Quality and Pollen:** Iceland is absent from both current official [air quality](https://developers.google.com/maps/documentation/air-quality/coverage) and [pollen](https://developers.google.com/maps/documentation/pollen/coverage) country lists. Neither is needed for this imagery layer.
- **OpenStreetMap:** a useful open vector source for roads, paths, buildings and POIs, under [ODbL](https://www.openstreetmap.org/copyright); it is not a satellite imagery source. An [Iceland extract](https://download.geofabrik.de/europe/iceland.html) is available for later vector layers. The public OSM tile servers have their own [usage policy](https://operations.osmfoundation.org/policies/tiles/). This build keeps the existing official road and national-name sources.
- **Loftmyndir ehf.:** a commercial option for detailed Iceland imagery, offered through [licensed WMS/WFS services](https://www.loftmyndir.is/vefjnustur). Its website describes [10–25 cm imagery](https://www.loftmyndir.is/loftmyndaflug), but this build does not assume a redistribution license.

Google configuration is outside the served directory at `/var/www/vhosts/vedrid.is/private/seifur/google.env`; it is not included in source archives. The browser-key field is `GOOGLE_MAPS_BROWSER_KEY`. The original JavaScript browser key was verified by rendering Google satellite/hybrid imagery. If its restriction is changed to the server IP for tile testing, a separate website-restricted browser key is needed before public Google rendering can continue. The tiny `api/google-config.php` endpoint deliberately exports only that browser key, with `no-store`; a separately configured server/tile key is never exported. If both fields contain the same value, the endpoint withholds that value and treats browser configuration as unavailable. Browser keys are visible to the client by design and must remain website/API restricted. The private template does not activate other Google APIs or enable App Check in the user's Cloud project. [App Check](https://developers.google.com/maps/documentation/javascript/places-app-check) requires separate Firebase/attestation setup and is not a replacement for API and website restrictions.

### On-demand browser tile cache

`tile-cache-sw.js` is a classic service worker scoped to `/v5/`, registered with a build-derived version query so CDN script caching cannot conceal a new worker version. It caches only successfully viewed Google 2D image tiles from this app’s proxy and locally hosted Sentinel WebP tiles. It does not download an entire area ahead of the visitor, cache viewport copyright metadata, or cache weather, GPS, camera frames or road feeds. Other resources and providers retain normal browser HTTP caching.

The Google image response verified on 18 November 2026 was `private, max-age=86400, must-revalidate, no-transform`. This permits a private browser cache with the response’s freshness lifetime; it does not permit a shared tile cache across visitors. The worker follows each actual response rather than hardcoding that duration. It accounts for upstream Date/Age and network delay, respects no-store/no-cache and explicit reload requests, and never serves expired entries. Variant (`Vary`) responses remain in the native HTTP cache rather than the extra worker cache. ETag revalidation is handled through normal HTTP behavior and the proxy. See [Google Map Tiles caching policies](https://developers.google.com/maps/documentation/tile/policies).

Viewed image bytes are stored only in that browser profile’s Cache Storage, bounded to 96 MiB / 1,500 entries with least-recently-used eviction and a 1 MiB per-image ceiling. Expired entries are removed on access/worker activation and cache maintenance; there is no permanent archive or offline map feature. Concurrent requests for the same tile share one fetch. Storage/private-browsing restrictions fall back to the browser HTTP cache without stopping the map. This reduces repeated billable requests but cannot guarantee zero Google charges: first views, new visitors, expiry, explicit reloads and storage eviction can still require Google requests. The hosted Sentinel source has no Google API requests.

`node v5/tests/tile-cache-browser.cjs` uses a local HTTP fixture and the real generated worker to check persistence across page loads/tabs, isolation between visitors, request deduplication, expiration/ETag validation, noncacheable/aged/Vary responses and byte-budget eviction. It makes no Google requests. Policy unit tests cover scope, freshness and header handling. API-mocked browser suites block service workers so cached data cannot bypass their fixtures.

### Google satellite tile delivery

`api/google-tiles.php` reads only the private server credential `GOOGLE_MAP_TILES_KEY`. Google sessions are obtained server-side with an IPv4 connection matching the configured IP restriction. Session tokens are retained privately with their API-provided expiry, shared across clients as supported by Google, and never sent to the browser. The public endpoint validates zoom/tile coordinates, restricts requests to tiles intersecting Iceland, checks website origin/referrer and applies a per-client request ceiling. It accepts no arbitrary upstream URL.

Satellite image bytes pass directly from the official service to the viewer. No Google image pyramid, offline archive or persistent server image cache is created. Upstream `Cache-Control`, `Date`, `Age`, `ETag`, `Expires`, `Last-Modified` and `Vary` headers are forwarded on successful images and revalidation responses. Conditional ETag/Last-Modified requests are forwarded, and a 304 no longer inherits the endpoint’s error-response `no-store` header. Only tiles for the current view are requested; Google requests start only beyond native Sentinel resolution and use the chosen detail level, reusing ready parents without fetching every intermediate level. The server credential is not part of HTML, JavaScript, image URLs or downloadable source archives.

Viewport metadata is requested for attribution and available detail. The renderer displays the unmodified official **Google Maps** logo and the returned source copyright strings before showing Google imagery. Credits remain distinct from the national terrain, names and aerial-overlay credits. The copyright year is not presented as the image acquisition date. Google coverage is clamped to the returned zoom availability; parent imagery remains while finer images arrive. If Google metadata/authentication is unavailable, the open Sentinel source remains usable. Source selection is automatic; there is no imagery picker.

A separate browser/referrer key is only needed for the optional [native Google comparison page](google/). It must differ from the private IP-restricted tile key. If the same key is placed in both fields, `google-config.php` withholds it from clients; the main Babylon tile integration can continue using the server credential.

## Interface languages

The flag button in the top bar opens five 44 px language buttons: **Íslenska, English, Deutsch, Français and Polski**. Icelandic is the initial default; the choice is saved in browser localStorage under `seifur-v5-language`. Changing language updates authored HTML, accessible labels, tooltips, placeholders, weather/station/road/counter cards, camera controls, clusters, legends and status/error text without reloading the scene. Current selections, map camera, card scroll and camera angle are retained; changing language does not fetch observations or reload camera frames. Proper place, station and road names, provider copyright strings and free-form source notices retain their source text. Known road-condition descriptions and all published gazetteer feature types have authored translations.

The translation source is `src/i18n-catalog.tsv`: Icelandic key followed by English, German, French and Polish, separated by `|`. `scripts/translations.mjs` validates all four translations and matching placeholders and generates the JS catalogue as part of the normal build. `src/i18n.js` binds only the original authored HTML, never arbitrary live text nodes. Dynamic components explicitly translate their UI labels and rerender on language change. Numbers use the selected locale, with explicit Icelandic number/date fallbacks for browsers lacking Icelandic ICU data; timestamps remain in Iceland’s time zone. Flags are locally hosted SVG assets, with native-language accessible names and keyboard navigation.

`i18n.test.js` checks catalogue completeness, static text/ARIA coverage, every published place type, interpolation, language notifications and numerical/missing-value handling. `i18n-browser.cjs` tests all five languages on desktop and phone, live station/counter/camera/place/group cards, names/camera/scroll retention, no additional observation/image requests, persistence, keyboard choice and the narrow phone toolbar. It uses fixtures and local Sentinel imagery, without Google requests.

## Station reading overlays

The **Mæligildi á korti** controls independently toggle wind/gust together, temperature and precipitation. They start off and can all be enabled simultaneously, independently of terrain tint and animated wind. Cards use the existing station snapshot and its existing refresh cycle; no additional weather or Google API calls are needed. Station-name labels are replaced by the reading cards while these overlays are active; place names avoid their occupied rectangles.

Every active station with valid coordinates projected into the viewport participates, with no station-count cap. Screen-space clustering merges colliding cards until they no longer overlap, adapting as the view is zoomed, moved or resized. A single card opens that station's existing detail view. A cluster shows the station count and the range of each available fresh measurement; selecting it opens a scrollable list of all member stations, with timestamps and station selection. Selecting either does not move the camera. Panning/pinching over a reading uses the existing map gestures, retaining DOM elements throughout the gesture.

Missing values remain **—**; zero is a reading. Measurements older than 30 minutes or without a valid timestamp are excluded from displayed current ranges and flagged; selecting the station can still show its dated original reading. Precipitation is displayed in the source's millimetres, with a notice that measurement periods can differ between stations. Ranges are not rainfall totals or regional averages.

`node v5/tests/station-overlays-browser.cjs` checks simultaneous/independent switches, representation of all 48 fixture stations, non-overlapping cluster cards, finer grouping on zoom, and station/group selection without camera movement on desktop and phone. The fixture uses locally hosted Sentinel imagery and no Google requests. Unit tests verify clustering coverage, separation, missing/zero values, stale exclusions and ranges.

## Roads and traffic

v5 shares root production's `/api/seifur-roads.php` endpoint without changing that endpoint. It aggregates road geometry from Vegagerðin WFS `faerdferlar2017_1`, conditions and notices from umferdin.is GraphQL, camera metadata from umferdin.is / Vegagerðin, and counters from WFS `umferdvika_2021_1`. Reuse follows the existing root integration. The source attribution and link to umferdin.is appear in detail cards.

Colored road lines follow the root condition categories, with red for closed/impassable and gray for unknown. The root API joins conditions to geometry using road number and sometimes name; detail cards disclose that match and its confidence where provided. This is an inferred join, not an exact surveyed road-condition boundary. Lines are simplified by approximately 35 m and split at terrain-triangle crossings so they follow the actual coarse, exaggerated terrain. They remain an overview rather than navigation geometry.

All road layers except winter service start enabled, matching root defaults. Winter-service lines are purple and expose published service days/hours when selected. Weight restrictions appear as orange lines and point notices; gross-weight notices are retained even when no structured axle restriction is provided. Alert date bounds are respected. Notices without coordinates use an approximate point on a related road, explicitly disclosed in the card. Icons are limited and decluttered at country scale, with more shown when zoomed in; search includes all records and separate directional counters.

Traffic icons show vehicles in the last 15 minutes. Detail cards retain real zero readings, missing values, direction and the seven available daily totals; the displayed mean uses available counts only. Counters older than 30 minutes or without timestamps are marked stale. The road feed's generation timestamp is separate from individual condition and counter timestamps; a feed older than 15 minutes is marked older. Road condition publication dates are shown as supplied, without treating every older road closure as expired weather.

Road line overlays render in a later Babylon rendering group, after the image textures. That group retains the terrain depth buffer, so lines remain visible over aerial/satellite imagery while terrain still hides roads behind hills. Condition lines have a 4 CSS px colored core, a 6 px dark casing and an 8 px light outer halo for contrast against both light and dark imagery. Winter/weight lines are 5/5.5 px and the selected road has a 6 px white core with a 9 px dark casing. GreasedLine uses CSS viewport resolution, keeping visible widths stable across render-quality settings and device pixel ratios. Road picking accepts the nearest enabled line within 24 CSS px (a 48 px corridor). Road map markers have compact visible badges inside touch targets of at least 44×44 px with greater separation: everyday camera badges are 24 px with a 15 px glyph, and traffic counts use a 22 px high pill with 12 px text and a subdued border/background. Other badges remain 34 px, and primary road-card text is 16 px. The pointer cursor indicates nearby clickable road lines. Winter, weight and selected-road lines use the same overlay pass.

Road rendering builds endpoint topology from the terrain-draped paths. Endpoints within 1 m horizontally and 5 m vertically share a rendering position. Degree-two continuations with the same displayed condition color are stitched into continuous polylines; common casings also continue across condition changes. At a color boundary, both cores use the adjoining segment's tangent for a shared miter, keeping the colors distinct. Branches do not select an arbitrary continuation, and wider gaps/grade-separated endpoints are not bridged. Source roads, source coordinates and individual selection remain separate. `road-joins.test.js` covers reversed pieces, small gaps, color boundaries, forks and loops; `road-joins-browser.cjs` checks actual rendered joints and individual section selection on desktop and phone.

Road data refreshes every 90 seconds while visible, independently of weather and terrain initialization. The existing endpoint has its own caching and background refresh. A failed update retains dated last-known data and shows a failure message. Camera images use the existing allowlisted `/api/seifur-camera-image.php` proxy and load only on selection. Every published camera angle is a labeled slide in a horizontal, scroll-snapping gallery. Swipe on a phone, scroll sideways on a trackpad, drag with a mouse, use previous/next buttons or focus the gallery and use arrow/Home/End keys. No angle dropdown is used. An automatic road refresh retains the viewed slide. Each image has its own load/error status, and one failed angle does not hide the others. Offscreen angles use native image lazy loading. A manual refresh reloads all angles, subject to the proxy's existing cache; the fetched time is not represented as the photo's capture time. Users are asked to check the time on the actual image.

## Terrain meaning and sources

The active scene now uses **ÍslandsDEM v1.0 and IS 50V Strandlína from Náttúrufræðistofnun**, following the requested [national base-map datasets](https://www.natt.is/is/midlun/kortagogn/grunnkortagogn). Both are used under **CC BY 4.0**, with attribution in the map and [full attribution notes](assets/NATT-ATTRIBUTION.md).

The height source is the official **50 m ISN93 zmasl GeoTIFF**. The importer verifies EPSG:3057 and pixel resolution, converts geographic coordinates into that projection, ignores NODATA, and bilinearly samples actual elevations. For a lightweight national scene, the displayed mesh uses a **241 × 181 grid, approximately 2.4 km**, plus coastal vertices and extra interior samples on small islands. The 50 m source resolution is not a claim of 50 m display detail. Elevations are rounded to metres and clamped at sea level.

The coastline source is the official **IS 50V Strandlína WFS**. The service returned edition **18 April 2024**, comprising 6,244 source polygons. The browser derivative retains **75 polygons**, including mainland Iceland, Heimaey, Surtsey, Grímsey and other islands above approximately 0.2 km². Rings are simplified by approximately 150 m, and triangles are generated per land polygon so there are no bridges between separate islands. Actual boundary edges are retained during the sea-crossing filter. The processing is a modified derivative, not the complete source geometry.

The previous Mapzen Terrain Tiles / USGS GMTED2010 / NOAA ETOPO1 grid is retained as an explicitly disclosed build-time fallback for land samples with no usable ÍslandsDEM value. The exact number of fallback samples is recorded in [NATT-PROVENANCE.json](assets/NATT-PROVENANCE.json). Visitors load the processed local asset; they do not download the large GeoTIFF, call the WFS, or separately fetch fallback elevation data.

**The vertical scale is fixed at ×1**, with no height slider. Terrain colors indicate elevation; pale mountain colors are not observed snow or glacier coverage. The decorative vertical edge skirt has been removed. The ocean and its coordinate grid sit at sea level (0 km); positive material depth offsets keep them behind flat coastal terrain without lowering the water or raising the land. The coastline outline uses a 5 m display offset instead of 120 m. A local kilometre-coordinate approximation remains in use for the national overview. This is not survey or navigation data, and terrain/coastline dates are distinct from the live weather timestamps.

Datasets and provenance:

- [Náttúrufræðistofnun base-map data](https://www.natt.is/is/midlun/kortagogn/grunnkortagogn).
- [ÍslandsDEM official metadata](https://gatt.natt.is/geonetwork/srv/api/records/e6712430-a63c-4ae5-9158-c89d16da6361) and [source raster directory](https://ftp.natt.is/gisdata/raster/). The source file is listed with a 30 August 2021 timestamp; that is not a survey date.
- [Open-data reuse terms](https://www.natt.is/is/midlun/opin-gogn) and [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
- [Local checksums, retrieval timestamps and processing parameters](assets/NATT-PROVENANCE.json).
- Original ÍslandsDEM processing credits include Veðurstofa Íslands and Polar Geospatial Center / ArcticDEM, with full upstream references in the official metadata.
- Fallback: GMTED2010 data courtesy of the U.S. Geological Survey; ETOPO1 from DOC/NOAA/NESDIS/NCEI. U.S. Government material is not subject to copyright protection within the United States. [Full fallback provider attribution](assets/TERRAIN-ATTRIBUTION.md).

The dataset has been resampled, simplified, clipped, clamped, triangulated by this application. These modifications are not endorsed by the original providers. Original source data is not replaced with synthetic terrain.

## Build and maintain

Use Node 24 from this server's existing installation:

```sh
NODENV_VERSION=24 npm ci --prefix v5
NODENV_VERSION=24 npm run build --prefix v5
NODENV_VERSION=24 npm test --prefix v5
# With Playwright/Chromium and its system libraries installed:
node v5/tests/browser.cjs
node v5/tests/roads-browser.cjs
```

For imagery/name browser checks also run `node v5/tests/imagery-browser.cjs`. `node v5/tests/google-tiles-browser.cjs` exercises the live, billable Google imagery integration. General weather/road/open-imagery QA selects `?imagery=sentinel` so those checks do not require Google credentials.

Or run `npm ci`, `npm run build` and `npm test` inside `v5/` on another machine. Babylon.js 9.37.0 and build tools are pinned in `package-lock.json`. The build emits locally hosted ES modules and copies the WebGPU shader compiler assets; no Babylon CDN is required at runtime. Automatic Google detail requires the private server key; Sentinel overview and fallback work without a Google key. HTML references the generated entry module by its content hash.

To rebuild the satellite pyramid and gazetteer, install the pinned build-only Python GIS dependencies in a virtual environment, then run:

```sh
python3 -m venv /path/to/seifur-geo
/path/to/seifur-geo/bin/pip install -r v5/scripts/requirements-geo.txt
/path/to/seifur-geo/bin/python v5/scripts/places.py
/path/to/seifur-geo/bin/python v5/scripts/imagery.py
/path/to/seifur-geo/bin/python v5/scripts/aerial.py
NODENV_VERSION=24 npm run build --prefix v5
```

`imagery.py` downloads the public quarter index and only source tiles intersecting retained Iceland land polygons. It reads three COG bands, caches RGB source derivatives, checkpoints a national mosaic and emits only land-intersecting WebP tiles. This is a substantial one-time build requiring several GB of disk and network transfer; the visitor never downloads those source rasters. The server used a temporary virtual environment for building; Python and the GIS packages are not runtime website dependencies. Raw caches stay in `.terrain-cache/` and are excluded from source archives. Cached rebuilds are not fresh acquisitions.

`aerial.py` compacts the WFS layer `loftmyndir:grunnkort_loftmynd_nidurhal`; its raw cache is `.terrain-cache/imagery/aerial-coverage.geojson`. It downloads and validates all current features in WGS84 if that cache is absent. Remove the cached input deliberately before a source refresh. Both aerial and gazetteer importers reject partial responses. The generated open satellite pyramid under `assets/imagery/0/` through `7/` must be retained on deployment even though it is excluded from the lightweight source archive.

To regenerate terrain:

```sh
NODENV_VERSION=24 npm run terrain --prefix v5
```

This fetches the approximately 118 MiB official 50 m GeoTIFF and the WFS shoreline once, caches them in `.terrain-cache/natt/`, samples height, simplifies the coastline and triangulates the land geometry. Build-time dependencies include GeoTIFF.js, Proj4js and simplify-js; no GIS toolchain is required in the visitor's browser. This command requires network access only when raw inputs are absent. It preserves and records source edition/timestamps and checksums.

The original open-data builder remains available as `npm run terrain:mapzen`. Its `assets/terrain.json` output is a build-time fallback; the active scene loads **`assets/terrain-natt.json`** with a build-generated cache key. The original Natural Earth asset remains for this fallback builder, not as the active shoreline. To refresh national source data deliberately, retain the old provenance and remove the cached national inputs before rebuilding; a cached rebuild is not a fresh data download.

Deploy `index.html`, `styles.css`, `tile-cache-sw.js`, `api/google-tiles.php` and the entire `assets/` directory together. The Google tile endpoint requires PHP with cURL and writable private configuration/session storage outside the public directory. Preserve JavaScript and WebAssembly MIME types, and use HTTPS for WebGPU. Deploy the optional `google/` directory and its `api/google-config.php` endpoint to enable the Google comparison view; keep its configuration outside the public directory. The PHP weather, road and camera APIs remain in the existing root `/api/` directory. `?renderer=webgl` forces the fallback for troubleshooting.

## Verification and limits

The live page was checked in Chromium with desktop, phone portrait and phone landscape viewports: terrain rendering, advancing frames, three weather modes (combined wind/gust, temperature and rain), fixed ×1 terrain height and fixed high rendering quality, exact station details, map selection, zoom, top-down view and pause. An API outage test verified that terrain still renders and no station readings are invented. Unit tests cover grid orientation, null data, stale fields, elevation interpolation, ISN93 projection, NODATA and north-first GeoTIFF pixels, complete coastline imports, island retention and triangulation, provenance, and upward terrain normals.

Imagery-specific browser checks cover the absent imagery picker, fixed 100% imagery strength, label visibility, official place search, Sentinel detail loading, portrait/landscape layout and an imagery outage preserving terrain/weather/names. `google-tiles-browser.cjs` uses mocked Google responses (no billed Google requests) to check zero Google requests in overview, automatic detail on zoom, the quality-independent threshold, required attribution, return to Sentinel on zoom-out, and both failure and coarser-coverage fallback on desktop and phone. Configuration tests verify that the server key is never exported, including when it duplicates the browser field.

`node v5/tests/road-accessibility-browser.cjs` checks 20 px near-miss taps/clicks, rejection outside the hit corridor, marker target size, larger detail text, unchanged camera selection, and rendered road widths at fixed high quality on desktop and phone.

`node v5/tests/camera-overlay-browser.cjs` verifies rendered road pixels over both an opaque Google-style imagery fixture and Sentinel imagery, road toggles, all camera angles, mouse drag/mobile swipe, keyboard navigation, retained slide position and per-image failure/recovery on desktop and phone. It uses deterministic camera/tile fixtures and does not bill Google requests.

Road-specific browser checks cover all six toggles, hiding all overlays, camera frame loading through the existing proxy, counter history, road details, responsive layout, independent road API failure, recovery, and retention of dated road data after a failed refresh. Unit tests also cover condition categories, unknown conditions, counter zero/null values, trusted image URLs, notice validity windows, inferred condition joins and line simplification.

WebGPU initialization was also exercised with the available software adapter. That adapter lost its device during rendering, so software adapters now use WebGL; later WebGPU device loss reloads once with an explicit WebGL backend. Actual hardware WebGPU rendering remains unverified here.

Phone-size emulation is not a physical iPhone/Safari or Android device test. The browser here uses software graphics; measured frame rates here are not representative of a phone or desktop GPU. Check physical devices and both backends before choosing production defaults.

Road layers now follow root production. Thermals are not included. It now streams imagery detail within Iceland; it does not provide high-resolution terrain geometry or global map navigation.

Babylon.js is distributed under Apache 2.0; its license is in [assets/BABYLON-LICENSE.md](assets/BABYLON-LICENSE.md), and dependency notices are in [assets/BABYLON-NOTICE.md](assets/BABYLON-NOTICE.md). Terrain tooling uses ISC-licensed pngjs, ISC-licensed Delaunator and Unlicense-licensed robust-predicates as development dependencies. Existing Veðrið branding remains owned by its respective owner.

Rendering quality is fixed to **high** on desktop and phone: hardware scaling 0.8 and 1,400 wind particles. There is no quality selector or runtime quality setter. `seifurV5.quality` reports the actual engine scaling for QA.

The Kortlög panel opens at the top with compact road, station-reading, weather-field and place-name controls. Search follows the switches; status, provenance, coverage and explanations are grouped inside the initially closed **Gögn og skýringar** disclosure. Location details are also collapsed. Primary layer targets retain a 44 px minimum height on desktop and phone.

Explicit selections reset the relevant detail card to its top: roads/cameras/counters, stations, places and station clusters. Background station refreshes do not reset that reading position. `node v5/tests/card-scroll-browser.cjs` forces overflow and checks all four card types on desktop and phone, including station-refresh preservation and an unchanged map camera.

Copernicus/Sentinel and national terrain/gazetteer acknowledgements are inside the initially collapsed **Gögn og skýringar** panel section rather than a lower-left map overlay. Google’s on-map credits remain tied to visible Google detail. The map’s bottom clearance reserves space only for Google credits when shown.

Weather legends start hidden and appear only after the **Litaskýringar** toggle in Kortlög is enabled. Wind and gust scales share that control; switching weather layers updates their contents but never enables the legend. The choice lasts for the current page visit.

The pin control in the Kortlög header keeps the panel open during map taps and feature selection, and saves that preference in browser localStorage when available. Close, the Kortlög button and Escape can still explicitly close it. Pinned controls and selected details remain visible together: opposite sides on desktop/landscape and stacked with a map gap on portrait phones. Explicitly enabled legends also remain available while pinned, unless a detail card occupies that area. `pinned-panel-browser.cjs` verifies dismissal, persistence, independent details, legend toggling and unchanged camera behavior on desktop, portrait phone and landscape.

Station measurement overlays use the blue Vedrid road-sign appearance: white Transport headings, black measurement windows and amber 5×7 dot-matrix numerals. The local font and glyph shapes come from the existing `cdn.vedrid.is` widget; the overlay renders locally from Seifur's measurements without embedding that widget or making additional observation requests. Wind and gust remain paired; temperature and rain can be added independently. Decimal precision, zero, missing values, negatives and ranges are retained. Gusts of at least 19 m/s use red numerals, while smaller gusts remain visible. Single stations show their observation time and, when valid, a direction indicator. Groups show measurement ranges without implying a shared observation time. Clustering reserves the larger sign footprint and station selection keeps the camera still.

All four detail cards (station, road/camera/counter, place and weather group) now share outside-pointer dismissal on desktop and touch screens. Inside interactions retain the card. The actual close actions clear selection and invalidate pending station responses, so late observations cannot reopen a dismissed card; pinned Kortlög controls remain open. Pointer taps on other controls, including the language flag, also dismiss the current detail. Keyboard language selection can still translate an open detail without a pointer dismissal. `card-dismiss-browser.cjs` checks all detail kinds, inside/outside taps, delayed observations, pinned controls and an unchanged map camera in desktop and phone layouts.

Production is now served directly at https://seifur.vedrid.is/; `/v5/` remains the development/source location and a separately accessible runtime. WebGPU compiler URLs and viewed-tile caching support both paths. See [production deployment notes](/v5/PRODUCTION.md) for the runtime layout and rollback procedure.
