Search the offline map and Wikipedia, nearest results first
CI / check (push) Successful in 26s
CI / deploy (push) Successful in 33s

Every named OSM object in each country's Geofabrik extract goes into a
SQLite FTS5 index (data/places/<CODE>.sqlite, lib/maptool/places.rb),
built as the last offline-build step or on its own with
rake places:index. Kiwix full-text search is another source; clicking a
hit opens the article. Results from every source are sorted by distance
from the map center (settlements weighted closer) and show it; each
source is queried separately so a slow one doesn't hold up the list.
This commit is contained in:
randy committed 2026-11-12 12:13:13 +01:00
1 parent ba9c40ac3d
commit 3f973a26d7
14 files changed
+549 -90

No files matched your search

+8 -4
View File
@@ -209,7 +209,7 @@ class PmtilesBuilderTest < Minitest::Test
assert_path_exists File.join(@data_dir, "offline.pmtiles")
refute_path_exists File.join(@data_dir, "offline.tmp.pmtiles")
assert_equal "done", Maptool::PmtilesBuilder.offline_status[:state]
assert_equal ["planetiler --osm-path", "osmium tags-filter", "osmium add-locations-to-ways", "osmium cat"], log_lines
assert_equal ["planetiler --osm-path", "osmium tags-filter", "osmium add-locations-to-ways", "osmium cat", "osmium tags-filter", "osmium export"], log_lines
assert_equal(
{ "sources" => [{ "code" => "SK", "slug" => "europe/slovakia", "last_modified" => "Wed, 10 Sep 2026 08:00:01 GMT" }] },
Maptool::PmtilesBuilder.offline_meta(@data_dir),
@@ -225,7 +225,7 @@ class PmtilesBuilderTest < Minitest::Test
failed, done = Maptool::PmtilesBuilder.build_history(@data_dir)
assert_equal ["error", "done"], [failed["state"], done["state"]]
assert_equal ["offline", ["SK"]], done.values_at("kind", "regions")
assert_equal ["fetching SK (1/1)", "tiling with planetiler", "extracting hiking trails"], done["timings"].map { |t| t["step"] }
assert_equal ["fetching SK (1/1)", "tiling with planetiler", "extracting hiking trails", "indexing places"], done["timings"].map { |t| t["step"] }
assert(done["timings"].all? { |t| t["seconds"] >= 0 })
assert done.key?("log")
assert_match(/boom/, failed["message"])
@@ -261,12 +261,14 @@ class PmtilesBuilderTest < Minitest::Test
# since the first build), so only AT's hiking trails get (re-)extracted
# — SK.osm.pbf itself is also skipped by cached_extract's own
# Last-Modified check, "osmium merge" runs regardless since two
# countries are now selected.
# countries are now selected. Same for the places index.
assert_equal(
["osmium merge", "planetiler --osm-path", "osmium tags-filter", "osmium add-locations-to-ways", "osmium cat"],
["osmium merge", "planetiler --osm-path", "osmium tags-filter", "osmium add-locations-to-ways", "osmium cat",
"osmium tags-filter", "osmium export"],
log_lines,
)
assert_equal %w[AT SK], Maptool::PmtilesBuilder.hiking_trails_countries(@data_dir)
assert_equal %w[AT SK], Maptool::PmtilesBuilder.places_countries(@data_dir)
end
# The actual reasoning: hiking trails are a bonus overlay bolted onto the
@@ -297,6 +299,8 @@ class PmtilesBuilderTest < Minitest::Test
"osmium merge", "planetiler --osm-path",
"osmium tags-filter", "osmium add-locations-to-ways", "osmium cat", # SK's own hiking-trails extraction
"osmium tags-filter", "osmium add-locations-to-ways", "osmium cat", # AT's own
"osmium tags-filter", "osmium export", # SK's places index
"osmium tags-filter", "osmium export", # AT's
],
log_lines,
)