diff --git a/chasemapper/config.py b/chasemapper/config.py index cd802ba..f1bdf7d 100644 --- a/chasemapper/config.py +++ b/chasemapper/config.py @@ -23,6 +23,7 @@ default_config = { "default_alt": 0, "payload_max_age": 180, "thunderforest_api_key": "none", + "stadia_api_key": "none", # Predictor settings "pred_enabled": True, # Enable running and display of predicted flight paths. "offline_predictions": False, # Use an offline GFS model and predictor instead of Tawhiri. @@ -163,6 +164,12 @@ def parse_config_file(filename): logging.info("Missing default_alt setting, using default (0m)") chase_config["default_alt"] = 0 + try: + chase_config["stadia_api_key"] = config.get("map", "stadia_api_key") + except: + logging.info("Missing Stadia API Key setting, using default (none)") + chase_config["stadia_api_key"] = "none" + # Telemetry Source Profiles _profile_count = config.getint("profile_selection", "profile_count") diff --git a/horusmapper.cfg.example b/horusmapper.cfg.example index 019754b..874d332 100644 --- a/horusmapper.cfg.example +++ b/horusmapper.cfg.example @@ -108,6 +108,11 @@ payload_max_age = 180 # Once you have a key, enter it below: thunderforest_api_key = none +# Stadia Maps API Key +# Stadia provides an excellent Dark map layer (Alidade Smooth Dark), which is looking promising for use in a 'dark mode' theme. +# Accessing this requires registering at https://client.stadiamaps.com/signup/ then creating a 'property' +# and obtaining an API key. Once you have a key, enter it below: +stadia_api_key = none # Predictor Settings # By default this will attempt to get predictions from the online Tawhiri Predictions API. diff --git a/templates/index.html b/templates/index.html index 100b4a0..fef7214 100644 --- a/templates/index.html +++ b/templates/index.html @@ -240,6 +240,7 @@ attribution: '© '+esrimapLink+', '+esriwholink, maxZoom: 18, }); + // Dark Matter map layer, one of the maps suitable for 'dark mode' var dark_matter_map = L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/dark_all/{z}/{x}/{y}.png', { attribution: '© Carto' }); @@ -259,6 +260,16 @@ } + if (chase_config.stadia_api_key !== 'none'){ + // Stadia Alidade Smooth Dark Layer. + var alidade_smooth_dark = L.tileLayer('https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/{z}/{x}/{y}{r}.png?apikey='+chase_config.stadia_api_key, + { + attribution: '© Stadia Maps, © OpenMapTiles © OpenStreetMap contributors' + }); + map_layers['Alidade Smooth Dark'] = alidade_smooth_dark; + + } + // Add Offline map layers, if we have any. for (var i = 0, len = chase_config.offline_tile_layers.length; i < len; i++) { var _layer_name = chase_config.offline_tile_layers[i];