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:
randy committed 2026-09-07 22:38:22 +02:00
1 parent dd272ffb8a
commit dd0ad6d845
6 files changed
+72 -2

No files matched your search

+10
View File
@@ -51,11 +51,21 @@ module Maptool
"category" => child_text(wpt, "type"),
"color" => ext[:color],
"icon" => ext[:icon],
"photos" => waypoint_photos(wpt),
},
}
end
private_class_method :waypoint_feature
# <link> is plain GPX 1.1 (a wpt/trk/rte can carry any number of them),
# not a vendor extension like waypoint_style's <osmand:*> — a newer
# p4n2gpx export started emitting one per park4night listing photo. A
# plain GPS waypoint has none, so this is almost always empty.
def self.waypoint_photos(wpt)
wpt.get_elements("link").filter_map { |link| link.attributes["href"] }
end
private_class_method :waypoint_photos
OSMAND_NAMESPACE = "https://osmand.net"
private_constant :OSMAND_NAMESPACE