Search: look through all saved layers and offline hiking trails

GET /api/search (lib/maptool/search.rb) matches feature name and
description, case- and diacritics-insensitive, across every file in
Tracks & Points (shown or not) and every offline hiking-trails country.
Parsed features are cached in memory per file by mtime.

The search box now queries local sources and Nominatim side by side,
labels each result with where it was found, lets you untick sources,
and switches a result's layer on if it was off before zooming to it.
This commit is contained in:
randy committed 2026-11-12 11:37:42 +01:00
1 parent 2611713489
commit 0051a0337c
10 files changed
+316 -21

No files matched your search

+8 -2
View File
@@ -444,7 +444,8 @@ const SLOVAKIA_BOUNDS = [
[16.83, 47.73],
[22.57, 49.61],
];
map.addControl(new SearchControl(), "top-left");
const searchControl = new SearchControl();
map.addControl(searchControl, "top-left");
map.addControl(new HomeButton({ bounds: SLOVAKIA_BOUNDS }), "top-left");
// showCompass: false — this map never rotates, so a bearing-reset button
// (NavigationControl's default third button) would just be dead weight.
@@ -545,9 +546,14 @@ const profilePanel = new TrackProfilePanel(map);
profilePanel.mount();
sidebar.insertAdjacentHTML("beforeend", `<div class="sidebar-group-label" title="Explorer"></div>`);
new GpxPanelControl(map, profilePanel).mount(sidebar);
const gpxPanel = new GpxPanelControl(map, profilePanel);
gpxPanel.mount(sidebar);
const overlaysControl = new OverlaysControl(map);
overlaysControl.mount(sidebar);
searchControl.setLayerOpeners({
layers: (path) => gpxPanel.show(path),
hiking_trails: (code) => overlaysControl.showHikingTrailsCountry(code),
});
pitchToggle.setOverlaysControl(overlaysControl);
// Running a plugin needs a login (POST /api/plugins/:name/run) — same
// "hide the write-only affordance" story as NotesControl above.