Wire offline hiking trails into the real build, API, and renderer
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 12s

data/hiking_trails.geojson now generates automatically as the last
step of every offline.pmtiles build (PmtilesBuilder.extract_hiking_trails,
best-effort — a failure here doesn't fail the whole build), merged
across all selected countries with cross-border dedup by OSM relation
id (HikingTrails.extract_merged). Served at GET /tiles/hiking_trails.geojson
and GET /api/hiking-trails, fetched client-side only once the overlay
is actually toggled on.

hiking_trails.js now prefers this local file whenever it exists,
regardless of which base map (online/offline) is active — same
"prefer local when available" story as HillshadeControl already uses
for terrain. Offline click hit-tests the real vector layer directly
(queryRenderedFeatures) instead of querying Overpass — instant, no
network. Coordinates are rounded to 5dp to keep the combined file
smaller; colour tag values are normalized against a known-safe set
before ever reaching a style paint property.

Verified extract_merged (new: combines multiple countries' extracts,
dedupes overlapping relations) against two real cached country PBFs
on brick directly, not just fixtures.
This commit is contained in:
randy committed 2026-09-13 10:31:59 +02:00
1 parent b35ace9734
commit 079ac37787
11 files changed
+370 -25

No files matched your search

+9
View File
@@ -39,6 +39,15 @@ class AppTest < Minitest::Test
assert_equal({ "available" => false }, json_body(response))
end
def test_hiking_trails_reports_unavailable_when_no_geojson_present
response = request.get("/api/hiking-trails")
assert_equal({ "available" => false }, json_body(response))
end
def test_hiking_trails_file_404s_when_no_geojson_present
assert_equal 404, request.get("/tiles/hiking_trails.geojson").status
end
def test_kiwix_reports_unavailable_when_no_url_configured
response = request.get("/api/kiwix")
assert_equal({ "available" => false, "url" => "" }, json_body(response))