Show waypoint photos from newer p4n2gpx exports
A newer p4n2gpx run (Ruby rewrite, ~/test/mapping/p4n2gpx) started emitting one plain GPX <link href> per park4night listing photo, which this app parsed but never displayed. Gpx.waypoint_photos collects them into a photos property; the waypoint popup renders them as a row of thumbnails above the description, each opening full-size in a new tab. Absent on older exports and plain GPS waypoints, so the row just doesn't render for those.
This commit is contained in:
1 parent
dd272ffb8a
commit
dd0ad6d845
6 files changed
+72
-2
No files matched your search
Vendored
+5
@@ -20,4 +20,9 @@
|
||||
<locus:icon xmlns:locus="http://www.locusmap.eu">res/drawable-hdpi/ic_parking_small.png</locus:icon>
|
||||
</extensions>
|
||||
</wpt>
|
||||
<wpt lat="48.103" lon="17.203">
|
||||
<name>With photos</name>
|
||||
<link href="https://cdn3.park4night.com/lieu/1_100/1_gd.jpg"><text>Photo</text></link>
|
||||
<link href="https://cdn3.park4night.com/lieu/1_100/2_gd.jpg"><text>Photo</text></link>
|
||||
</wpt>
|
||||
</gpx>
|
||||
@@ -74,6 +74,18 @@ class GpxTest < Minitest::Test
|
||||
assert_nil plain["properties"]["icon"]
|
||||
end
|
||||
|
||||
def test_waypoint_captures_link_hrefs_as_photos
|
||||
geojson = Maptool::Gpx.to_geojson(fixture_path("sample_poi.gpx"))
|
||||
with_photos = geojson["features"].find { |f| f["properties"]["name"] == "With photos" }
|
||||
plain = geojson["features"].find { |f| f["properties"]["name"] == "Plain waypoint" }
|
||||
|
||||
assert_equal(
|
||||
["https://cdn3.park4night.com/lieu/1_100/1_gd.jpg", "https://cdn3.park4night.com/lieu/1_100/2_gd.jpg"],
|
||||
with_photos["properties"]["photos"]
|
||||
)
|
||||
assert_empty plain["properties"]["photos"]
|
||||
end
|
||||
|
||||
def test_kinds_detects_routes
|
||||
assert_equal ["route"], Maptool::Gpx.kinds(fixture_path("sample_route.gpx"))
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user