From 1733fc7c1b040157fb041aae1102cb5cbce3eb5e Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Wed, 9 Sep 2026 17:14:20 +0200 Subject: [PATCH] Give Overpass POI downloads icons/descriptions and unique filenames 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/... --- app.rb | 15 ++++++-- lib/maptool/overpass_pois.rb | 68 +++++++++++++++++++++++++++--------- public/js/icons.js | 16 +++++++++ test/test_app.rb | 2 +- test/test_overpass_pois.rb | 38 ++++++++++++++++++++ 5 files changed, 119 insertions(+), 20 deletions(-) diff --git a/app.rb b/app.rb index 2a7a216..ec10768 100644 --- a/app.rb +++ b/app.rb @@ -356,13 +356,24 @@ module Maptool bbox = %w[south west north east].map { |key| params[key].to_s } halt 400, json(error: "south, west, north, east are required") if bbox.any?(&:empty?) + south, west, north, east = bbox.map(&:to_f) begin - geojson = Plugins.run(PLUGINS_DIR, params[:name], bbox.map(&:to_f)) + geojson = Plugins.run(PLUGINS_DIR, params[:name], [south, west, north, east]) rescue Plugins::RunError => e halt 502, json(error: e.message) end - path = GPX_STORE.save(folder: "", filename: "#{params[:name]}.geojson", io: StringIO.new(JSON.generate(geojson))) + # Filename carries the area's center and the run's timestamp (same + # idea as a p4n2gpx export's own "p4n_area____