Hiking trails: the main checkbox loads the countries in view from zoom 10 (and those panned into), not all at once — together ~1 GB of GeoJSON the browser never finished; /api/hiking-trails also sends each country's bbox

This commit is contained in:
randy committed 2026-11-27 14:29:29 +01:00
1 parent 477f68f5b3
commit f0ff5f390f
5 files changed
+52 -20

No files matched your search

+3 -2
View File
@@ -600,9 +600,10 @@ module Maptool
# the country they actually pick in the Hiking trails overlay's own
# checklist (public/js/hiking_trails.js), not every selected country's
# trails at once — `countries` lists which ones exist to build that
# checklist from.
# checklist from, `bboxes` ([w, s, e, n] each) which are in view.
get "/api/hiking-trails" do
json countries: PmtilesBuilder.hiking_trails_countries(DATA_DIR)
countries = PmtilesBuilder.hiking_trails_countries(DATA_DIR)
json countries: countries, bboxes: countries.to_h { |code| [code, PmtilesBuilder.country_bbox(code)] }.compact
end
# Fetched client-side only for a country the viewer actually ticks in