diff --git a/.env.example b/.env.example index 26aff1e..ea7f6c2 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/README.md b/README.md index 7f6d7a9..fff3fdb 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/backend/app.py b/backend/app.py index 6f76eed..2c5335f 100644 --- a/backend/app.py +++ b/backend/app.py @@ -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, diff --git a/backend/static/index.html b/backend/static/index.html index e7748b9..e3d28bf 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -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; diff --git a/docker-compose.yaml b/docker-compose.yaml index ae54787..9e6d084 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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 diff --git a/docs.md b/docs.md index ef9ec24..f8e7630 100644 --- a/docs.md +++ b/docs.md @@ -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.