NPS park maps overlay: park points and map footprints, a park search, a park popup listing its Harpers Ferry Center maps with local PDF/GeoTIFF links, and the 289 georeferenced ones laid over the base map with an opacity slider; data from data/nps served by /api/nps and /nps/{overlay,geotiff,pdf}
This commit is contained in:
1 parent
ff5924faf1
commit
3fc8c75c60
8 files changed
+421
-6
No files matched your search
@@ -1011,6 +1011,30 @@ module Maptool
|
||||
json(type: "FeatureCollection", features: features)
|
||||
end
|
||||
|
||||
# NPS park maps (the "NPS park maps" overlay, public/js/nps.js): Harpers
|
||||
# Ferry Center brochure maps, public domain. data/nps/ holds nps.json (the
|
||||
# index: parks with bboxes, maps with download links and, for the 289
|
||||
# georeferenced ones, overlay corners) plus overlay/ (JPEGs), geotiff/ and
|
||||
# pdf/ — built outside this app by ~/Projects/NPS_Maps/nps-maps.py. Absent
|
||||
# = the overlay stays disabled.
|
||||
NPS_DIR = File.join(DATA_DIR, "nps")
|
||||
|
||||
get "/api/nps" do
|
||||
path = File.join(NPS_DIR, "nps.json")
|
||||
halt 404, json(error: "no NPS data") unless File.exist?(path)
|
||||
|
||||
cache_control :public, max_age: 3600
|
||||
send_file path, type: "application/json"
|
||||
end
|
||||
|
||||
get %r{/nps/(overlay|geotiff|pdf)/([\w.@-]+)} do |kind, name|
|
||||
path = File.join(NPS_DIR, kind, name)
|
||||
halt 404 unless File.file?(path)
|
||||
|
||||
cache_control :public, max_age: 86_400
|
||||
send_file path, disposition: kind == "geotiff" ? "attachment" : "inline"
|
||||
end
|
||||
|
||||
get "/api/live" do
|
||||
require_login!
|
||||
now = Time.now.to_f
|
||||
|
||||
Reference in new issue
Block a user