Replace the per-popup "Nearby on Wikipedia" link with a live Wikipedia layer

The old link only ever surfaced one nearby article at a time, buried
in whatever POI's popup you happened to open, and only for uploaded
files with a category. Replaced it with a standalone "Wikipedia"
toggle under the renamed "Tracks & Points" panel: enabling it adds a
live map layer that refetches GET /api/kiwix/nearby on every pan/zoom
and plots every nearby article as its own point.

kiwix-serve's own geo search never echoes back a result's coordinates
(confirmed live against the real production ZIM, both its HTML and
?format=xml output) — it only filters by distance from a point. So
Maptool::Kiwix.nearby fetches each matching article's own page too and
reads its <meta name="geo.position"> tag, which every geotagged
Wikipedia article carries. Tried parallelizing those per-article
fetches with threads first; measured no improvement against the real
ZIM (kiwix-serve appears to serialize requests regardless), so it
stayed sequential — ~1.6s for a 30-result page, fine for a
refetch-on-pan-end layer.

Clicking a point opens a small popup linking to the article (proxied
through the existing /kiwix/* passthrough). New WIKI_ICON (NPS's
bookstore-22.svg) marks these, kept out of POI_ICONS since that set
doubles as notes.js's icon-picker option list and this fixed-glyph
layer has no per-feature category to key off of.
This commit is contained in:
randy committed 2026-09-10 20:45:41 +02:00
1 parent 47e3f9c7e8
commit 787df5478d
9 files changed
+354 -14

No files matched your search

+10 -1
View File
@@ -47,7 +47,7 @@
<div id="gpx-panel" class="gpx-panel" hidden>
<div class="gpx-panel__header">
<strong>Tracks</strong>
<strong>Tracks &amp; Points</strong>
<div class="gpx-panel__actions">
<button type="button" class="gpx-panel__action" data-action="new-folder" title="New folder" aria-label="New folder"></button>
<button type="button" class="gpx-panel__action" data-action="upload" title="Upload GPX/FIT/GeoJSON file" aria-label="Upload GPX/FIT/GeoJSON file"></button>
@@ -58,6 +58,15 @@
<input type="file" class="gpx-file-input" accept=".gpx,.fit,.geojson,.zip" multiple hidden>
<p class="gpx-upload__status" hidden></p>
<!-- Not a real file in the tree below: a live layer, refetched from the
offline Wikipedia ZIM (via kiwix-serve) for whatever's on screen as
the map pans/zooms, not a saved .geojson. Hidden entirely when no
kiwix-serve is configured (see gpx.js's mount()). -->
<label class="gpx-panel__wiki" hidden>
<input type="checkbox" class="gpx-panel__wiki-toggle">
<span>Wikipedia</span>
</label>
<div class="gpx-tree"></div>
<div class="gpx-legend" hidden></div>
</div>