Add a hillshade/terrain-shading toggle to the map
Sidebar toggle (new HillshadeControl) adds a raster-dem hillshade layer: public Terrarium tiles when online, or a local data/terrain.pmtiles when present (mirrors offline.pmtiles' optional- local-file pattern, new /api/terrain-tiles + /tiles/terrain.pmtiles endpoints). No offline terrain data is bundled, so the toggle is online-only until one is generated — see docs/development.adoc for how.
This commit is contained in:
1 parent
f49e44800a
commit
77a4c96b1c
5 files changed
+115
-4
No files matched your search
@@ -58,6 +58,7 @@ module Maptool
|
||||
DATA_DIR = ENV.fetch("MAPTOOL_DATA_DIR") { File.join(__dir__, "data") }
|
||||
|
||||
OFFLINE_PMTILES_PATH = File.join(DATA_DIR, "offline.pmtiles")
|
||||
TERRAIN_PMTILES_PATH = File.join(DATA_DIR, "terrain.pmtiles")
|
||||
GPX_STORE = GpxStore.new(File.join(DATA_DIR, "gpx"))
|
||||
LIVETRACK_STORE = LiveTrackStore.new(File.join(DATA_DIR, "livetrack.json"))
|
||||
|
||||
@@ -185,6 +186,19 @@ module Maptool
|
||||
send_file OFFLINE_PMTILES_PATH, type: "application/octet-stream"
|
||||
end
|
||||
|
||||
# Same optional-local-file story as offline.pmtiles above — see
|
||||
# docs/development.adoc for how to generate one, until then hillshade
|
||||
# just stays unavailable while the offline basemap is active.
|
||||
get "/api/terrain-tiles" do
|
||||
json available: File.exist?(TERRAIN_PMTILES_PATH)
|
||||
end
|
||||
|
||||
get "/tiles/terrain.pmtiles" do
|
||||
halt 404 unless File.exist?(TERRAIN_PMTILES_PATH)
|
||||
|
||||
send_file TERRAIN_PMTILES_PATH, type: "application/octet-stream"
|
||||
end
|
||||
|
||||
get "/api/gpx/tree" do
|
||||
json GPX_STORE.tree
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user