planner: add the Weather data layer (temperature, rain, night lows) - #2348
Merged
Merged
Conversation
…lows The Weather layer reads the climate archive. A switch in the date bar selects the map: daytime highs, corrected to the terrain height of each pixel, or the ten-year wet-day share. Both blend the four nearest cells. The year slider has High, Rain and Low rows. The profile strip shows the daytime high. The point chart shows the years of highs, lows and rain against a typical week. A label at each overnight stop shows the night lows of its week. DataLayer gets one optional method, nights(), for the overnight labels, and an optional strip label. The terrain helper caches decoded DEM tiles per DEM tile, so four map tiles share one fetch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- A map point in Rain mode reads its height from the DEM tile of the view zoom, so highs and lows are at the point height. - openClimate keeps one climate source per archive URL, so Weather and Wind share decoded tiles. - The dark temperature ramp is lighter from 0 to 30 °C. - The point chart follows the map variable: highs and lows, or rain. - The rain chart is a 52-week line of the mean wet days of 7, with a band for most years and the layer week marked. - The year slider rows are High, Low, Rain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MapLibre rounds the zoom for raster sources, so the 512 px relief loads round(zoom). The point height now reads that tile, which the browser cache holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
This adds the Weather data layer to the website planner. It follows the owner decisions on #2329 (layers Snow / Weather / Wind, one on the map at a time).
layers/registry.tson theclimatearchive. The layer requests nothing while it is off.Changes to shared code
DataLayergets one optional method,nights(samples, stops), and an optionalstrip.label. PlannerApp gives the trip day ends as stops. PlannerMap draws the labels as panel pills beside the day-end pins.climate-source.ts:openClimate(url)keeps one source per archive URL, so Weather and Wind share the decoded tiles. It is the same function as in the Wind PR planner: add the Wind data layer #2349.climate-terrain.ts:tileHeightsbecomesdemPixelspluspixelHeight. The layer caches decoded DEM tiles per DEM tile, so four map tiles share one fetch and one decode.addDaysindata-layer.ts, used by the date bar and the night dates.LayerInspect: compact charts with more than one grid use 3 px rows.RainWeeks.svelte: the rain chart, given to the point chart asChart.extra.pretest:plannergetsVITE_PLANNER_CLIMATE_URL, so the journey builds with the layer in the menu. The budget is unchanged.Verification (BW archive, local preview)
2-day loop Freiburg – St. Märgen – Titisee – Notschrei – Freiburg (101.5 km), checked in May and January, light and dark: switch, map colours, slider rows, night label, strip, point chart, map callout, legend in the layer menu. No runtime console errors.
Requests while the layer is off: no climate request. Turning the layer on: 4 range requests on
climate.pmtiles(header, directory, overview and detail data). The 6 terrain fetches are the same DEM URLs that the relief loaded. The tile Worker sendsimmutablecaching for them, so the browser cache answers them. The local pmtiles server sends no cache header, so the browser revalidates them locally (304).Paint time: 15 map tiles, mean 3 ms, longest 6 ms per 256 px tile.
Dark mode: the temperature stops from 0 to 30 °C are lighter, so May and January stay readable on the dark land colour.
Checks run
npx vitest run src/lib/planner src/components/planner: 30 files, 192 tests pass. The newweather.test.tscovers colour mapping, pixel blending and terrain correction, the year rows and label, the rain weeks and both charts, and the night labels.svelte-check: no new findings. The 15 remaining errors are the missing wasmpkg/builds in untouched files.npm run test:planner: passes. The totals are unchanged from the budget (cloudflare=104).obc suites check,obc prose --check: OK.Public docs changed: no
Requirements: none
🤖 Generated with Claude Code