Trails by kind: the extract keeps hiking, foot, bicycle, mtb and ski routes, each with a kind (educational told apart by educational=yes, the green diagonal marking or the name); versioned so the next offline build redoes old files; the overlay picks kinds (hiking and educational by default), the elevation profile shows the ones for the activity
This commit is contained in:
1 parent
4bcd85f269
commit
b32f7d3bd3
7 files changed
+92
-15
No files matched your search
@@ -38,6 +38,22 @@ class HikingTrailsTest < Minitest::Test
|
||||
assert_nil Maptool::HikingTrails.parse_opl(opl.sub("forward,w3@backward", ",w3@"))["features"].first["properties"]["oneway_lines"]
|
||||
end
|
||||
|
||||
def test_parse_opl_tells_hiking_educational_bicycle_and_ski_routes_apart
|
||||
opl = <<~OPL
|
||||
w1 Thighway=path Nn10x20.087y49.179,n11x20.088y49.18
|
||||
r1 Troute=hiking,name=Červená Mw1@
|
||||
r2 Troute=hiking,name=Náučný%20%chodník%20%Sitno Mw1@
|
||||
r3 Troute=foot,osmc:symbol=green:white:green_diagonal Mw1@
|
||||
r4 Troute=mtb,name=Okruh Mw1@
|
||||
r5 Troute=ski,name=Bežkárska Mw1@
|
||||
r6 Troute=bus Mw1@
|
||||
OPL
|
||||
|
||||
collection = Maptool::HikingTrails.parse_opl(opl)
|
||||
assert_equal %w[hiking educational educational bicycle ski], collection["features"].map { |f| f["properties"]["kind"] }
|
||||
assert_equal({ "version" => Maptool::HikingTrails::VERSION }, collection.slice("version"))
|
||||
end
|
||||
|
||||
def test_parse_opl_skips_relations_that_are_not_route_hiking
|
||||
opl = <<~OPL
|
||||
w1 Thighway=path Nn10x20.087y49.179,n11x20.088y49.18
|
||||
|
||||
@@ -278,7 +278,8 @@ class PmtilesBuilderTest < Minitest::Test
|
||||
# against real OPL fixtures.
|
||||
assert_equal ["SK"], Maptool::PmtilesBuilder.hiking_trails_countries(@data_dir)
|
||||
path = Maptool::PmtilesBuilder.hiking_trails_country_path(@data_dir, "SK")
|
||||
assert_equal({ "type" => "FeatureCollection", "features" => [] }, JSON.parse(File.read(path)))
|
||||
assert_equal({ "version" => Maptool::HikingTrails::VERSION, "type" => "FeatureCollection", "features" => [] }, JSON.parse(File.read(path)))
|
||||
assert Maptool::HikingTrails.current?(path)
|
||||
end
|
||||
|
||||
def test_build_offline_only_re_extracts_hiking_trails_for_a_newly_added_country
|
||||
|
||||
Reference in new issue
Block a user