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:
1 parent
47e3f9c7e8
commit
787df5478d
9 files changed
+354
-14
No files matched your search
@@ -32,6 +32,10 @@ class AppTest < Minitest::Test
|
||||
assert_equal 404, request.get("/kiwix/search").status
|
||||
end
|
||||
|
||||
def test_kiwix_nearby_404s_when_no_url_configured
|
||||
assert_equal 404, request.get("/api/kiwix/nearby", params: { south: "48", west: "17", north: "48.1", east: "17.1" }).status
|
||||
end
|
||||
|
||||
def test_gnss_position_unavailable_with_no_fix
|
||||
response = request.get("/api/gnss/position", **logged_in_env)
|
||||
assert_equal({ "available" => false }, json_body(response))
|
||||
|
||||
Reference in new issue
Block a user