aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fietsboek/views/tileproxy.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/fietsboek/views/tileproxy.py b/fietsboek/views/tileproxy.py
index 1c8a054..2a1e6d0 100644
--- a/fietsboek/views/tileproxy.py
+++ b/fietsboek/views/tileproxy.py
@@ -268,6 +268,12 @@ def extract_tile_layers(settings):
:rtype: list[TileSource]
"""
layers = []
+ layers.extend(_extract_thunderforest(settings))
+ layers.extend(_extract_user_layers(settings))
+ return layers
+
+
+def _extract_thunderforest(settings):
# Thunderforest Shortcut!
tf_api_key = settings.get("thunderforest.api_key")
if tf_api_key:
@@ -280,11 +286,13 @@ def extract_tile_layers(settings):
for tf_map in settings["thunderforest.maps"]:
url = (f"https://tile.thunderforest.com/{tf_map}/"
f"{{z}}/{{x}}/{{y}}.png?apikey={tf_api_key}")
- layers.append(TileSource(
+ yield TileSource(
f"tf-{tf_map}", f"TF {tf_map.title()}", url,
LayerType.BASE, 22, tf_access, tf_attribution,
- ))
+ )
+
+def _extract_user_layers(settings):
# Any other custom maps
for key in settings.keys():
match = re.match("^fietsboek\\.tile_layer\\.([A-Za-z0-9_-]+)$", key)
@@ -299,5 +307,4 @@ def extract_tile_layers(settings):
attribution = settings.get(f"{key}.attribution", _jb_copy)
access = LayerAccess(settings.get(f"{key}.access", "public"))
- layers.append(TileSource(provider_id, name, url, layer_type, zoom, access, attribution))
- return layers
+ yield TileSource(provider_id, name, url, layer_type, zoom, access, attribution)