Give Overpass POI downloads icons/descriptions and unique filenames
CI / check (push) Successful in 41s
CI / deploy (push) Successful in 12s

Overpass categories now carry the same icon+color styling a p4n2gpx
waypoint gets, instead of falling back to gpx.js's plain red marker,
plus a popup description built from opening_hours/operator/website
tags. Supermarket/convenience store reuse NPS's generic store glyph,
the only honest match in that icon set.

Each plugin run's saved filename now bakes in the area's center and a
timestamp, so repeated downloads for different areas land as separate,
identifiable files instead of overpass-pois.geojson/-1/-2/...
This commit is contained in:
randy committed 2026-09-09 17:14:20 +02:00
1 parent 72ffd0ef18
commit 1733fc7c1b
5 files changed
+119 -20

No files matched your search

+38
View File
@@ -22,6 +22,44 @@ class OverpassPoisTest < Minitest::Test
water = geojson["features"].find { |f| f["properties"]["category"] == "Drinking water" }
assert_equal [17.2, 48.1], water["geometry"]["coordinates"]
assert_equal "Drinking water", water["properties"]["name"], "falls back to the category when the node has no name tag"
assert_equal "amenity_drinking_water", water["properties"]["icon"]
assert_equal "#2e86de", water["properties"]["color"]
end
def test_to_geojson_assigns_icons_to_shop_categories
response = {
"elements" => [
{ "type" => "node", "lat" => 1, "lon" => 1, "tags" => { "shop" => "supermarket" } },
{ "type" => "node", "lat" => 2, "lon" => 2, "tags" => { "shop" => "convenience" } },
],
}
icons = Maptool::OverpassPois.to_geojson(response)["features"].map { |f| f["properties"]["icon"] }
assert_equal %w[shop_supermarket shop_convenience], icons
end
def test_to_geojson_builds_a_description_from_recognized_tags
response = {
"elements" => [
{
"type" => "node",
"lat" => 48.1,
"lon" => 17.2,
"tags" => { "amenity" => "toilets", "opening_hours" => "24/7", "operator" => "Town Council", "website" => "https://example.com" },
},
],
}
description = Maptool::OverpassPois.to_geojson(response)["features"].first["properties"]["description"]
assert_equal "Opening hours: 24/7\nOperator: Town Council\nhttps://example.com", description
end
def test_to_geojson_omits_description_when_no_recognized_tags_are_present
response = { "elements" => [{ "type" => "node", "lat" => 48.1, "lon" => 17.2, "tags" => { "amenity" => "toilets" } }] }
refute Maptool::OverpassPois.to_geojson(response)["features"].first["properties"].key?("description")
end
def test_to_geojson_uses_the_node_name_when_present