Add default map layer env

This commit is contained in:
yellowcooln 2025-12-26 03:17:43 +00:00
parent 9e6ad55a6b
commit 153cc501ab
6 changed files with 10 additions and 1 deletions

View file

@ -38,3 +38,4 @@ MQTT_SEEN_BROADCAST_MIN_SECONDS=5
MAP_START_LAT=42.3601
MAP_START_LON=-71.1500
MAP_START_ZOOM=10
MAP_DEFAULT_LAYER=light

View file

@ -72,6 +72,7 @@ Runtime tuning:
- `ELEVATION_CACHE_TTL` (seconds)
- `LOS_PEAKS_MAX` (max peaks shown on LOS profile)
- `MAP_START_LAT` / `MAP_START_LON` / `MAP_START_ZOOM` (default map view)
- `MAP_DEFAULT_LAYER` (`light`, `dark`, or `topo`; localStorage overrides)
## Common Commands
- Rebuild/restart: `docker compose up -d --build`

View file

@ -83,6 +83,7 @@ try:
MAP_START_ZOOM = float(os.getenv("MAP_START_ZOOM", "10"))
except ValueError:
MAP_START_ZOOM = 10
MAP_DEFAULT_LAYER = os.getenv("MAP_DEFAULT_LAYER", "light").strip().lower()
LOS_ELEVATION_URL = os.getenv("LOS_ELEVATION_URL", "https://api.opentopodata.org/v1/srtm90m")
LOS_SAMPLE_MIN = int(os.getenv("LOS_SAMPLE_MIN", "10"))
@ -1851,6 +1852,7 @@ def root():
"MAP_START_LAT": MAP_START_LAT,
"MAP_START_LON": MAP_START_LON,
"MAP_START_ZOOM": MAP_START_ZOOM,
"MAP_DEFAULT_LAYER": MAP_DEFAULT_LAYER,
"LOS_ELEVATION_URL": LOS_ELEVATION_URL,
"LOS_SAMPLE_MIN": LOS_SAMPLE_MIN,
"LOS_SAMPLE_MAX": LOS_SAMPLE_MAX,

View file

@ -444,7 +444,10 @@
maxZoom: 17,
attribution: '© OpenStreetMap contributors © OpenTopoMap'
});
let baseLayer = 'light';
let baseLayer = '{{MAP_DEFAULT_LAYER}}';
if (baseLayer !== 'dark' && baseLayer !== 'topo' && baseLayer !== 'light') {
baseLayer = 'light';
}
const storedLayer = localStorage.getItem('meshmapBaseLayer');
if (storedLayer === 'dark' || storedLayer === 'topo' || storedLayer === 'light') {
baseLayer = storedLayer;

View file

@ -34,6 +34,7 @@ services:
MAP_START_LAT: "${MAP_START_LAT:-42.3601}"
MAP_START_LON: "${MAP_START_LON:--71.1500}"
MAP_START_ZOOM: "${MAP_START_ZOOM:-10}"
MAP_DEFAULT_LAYER: "${MAP_DEFAULT_LAYER:-light}"
restart: unless-stopped
volumes:
- ./data:/data

View file

@ -31,6 +31,7 @@ This project renders live MeshCore traffic on a Leaflet + OpenStreetMap map. A F
- Legend is collapsible and persisted to localStorage.
- HUD is capped to `90vh` and scrolls to avoid running off-screen.
- Map start position is configurable with `MAP_START_LAT`, `MAP_START_LON`, `MAP_START_ZOOM`.
- Default base layer can be set with `MAP_DEFAULT_LAYER` (localStorage overrides).
- Node search (name or key) and a labels toggle (persisted to localStorage).
- Hide Nodes toggle hides markers and trails; routes remain visible.
- Propagation overlay keeps heat/routes/trails/markers above it after render.