Wire offline hiking trails into the real build, API, and renderer
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:
1 parent
b35ace9734
commit
079ac37787
11 files changed
+370
-25
No files matched your search
@@ -607,6 +607,11 @@ fetch("/api/terrain-tiles")
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
fetch("/api/hiking-trails")
|
||||
.then((response) => response.json())
|
||||
.then(({ available }) => overlaysControl.setHikingTrailsOfflineAvailable(available))
|
||||
.catch(() => {});
|
||||
|
||||
fetch("/api/kiwix")
|
||||
.then((response) => response.json())
|
||||
.then(({ available }) => overlaysControl.setWikiAvailable(available))
|
||||
|
||||
Reference in new issue
Block a user