Split offline hiking trails per country, add a picker instead of one big file
data/hiking_trails.geojson is now data/hiking_trails/<CODE>.geojson — one file per country instead of a merge, generated per-source (PmtilesBuilder.extract_hiking_trails), cached the same way geofabrik_cache is (skipped once a country's own extract is already newer than its source .osm.pbf, so growing the selection by one country only re-extracts that one). GET /api/hiking-trails now lists available country codes instead of a single file's status. The Overlays panel's "Hiking trails" item becomes an expandable per-country checklist once any offline extract exists (same shape as Radar's own expand), replacing the plain on/off checkbox — nobody covering a dozen countries' worth of offline map data needs all of their hiking trails loaded and parsed at once, so each ticked country fetches its own GeoJSON independently instead. HikingTrails.extract_merged (server-side multi-country merge, no longer needed now that the client picks per country) removed again. Verified the new extract_hiking_trails + caching skip live on brick against a real cached country PBF.
This commit is contained in:
1 parent
079ac37787
commit
c6e4a455b6
12 files changed
+300
-184
No files matched your search
@@ -111,21 +111,6 @@ class HikingTrailsTest < Minitest::Test
|
||||
assert_equal [[[20.08765, 49.17912], [20.088, 49.18]]], coords
|
||||
end
|
||||
|
||||
def test_extract_merged_deduplicates_by_relation_id_across_files
|
||||
feature = ->(id) {
|
||||
{ "type" => "Feature", "properties" => { "id" => id, "name" => "Trail #{id}" }, "geometry" => { "type" => "MultiLineString", "coordinates" => [] } }
|
||||
}
|
||||
# Relation 1 shows up in both "country" files (a cross-border trail);
|
||||
# relation 2 only in the second.
|
||||
per_file = { "at.osm.pbf" => [feature.call(1)], "cz.osm.pbf" => [feature.call(1), feature.call(2)] }
|
||||
extract = ->(pbf_path) { { "type" => "FeatureCollection", "features" => per_file.fetch(pbf_path) } }
|
||||
|
||||
merged = Maptool::HikingTrails.extract_merged(%w[at.osm.pbf cz.osm.pbf], extract: extract)
|
||||
ids = merged["features"].map { |f| f["properties"]["id"] }.sort
|
||||
|
||||
assert_equal [1, 2], ids
|
||||
end
|
||||
|
||||
def test_parse_opl_ignores_a_dangling_member_reference_but_keeps_the_rest
|
||||
opl = <<~OPL
|
||||
w1 Thighway=path Nn10x20.087y49.179,n11x20.088y49.18
|
||||
|
||||
Reference in new issue
Block a user