feat: Source from own tile server

This commit is contained in:
moanos [he/him] 2024-09-28 00:41:33 +02:00
parent a6fc870e68
commit c037563fd2
3 changed files with 10 additions and 3 deletions

View File

@ -3,8 +3,8 @@
{% load i18n %} {% load i18n %}
<!-- add MapLibre JavaScript and CSS --> <!-- add MapLibre JavaScript and CSS -->
<script src="https://tiles.versatiles.org/assets/maplibre-gl/maplibre-gl.js"></script> <script src="{% settings_value "MAP_TILE_SERVER" %}/assets/maplibre-gl/maplibre-gl.js"></script>
<link href="https://tiles.versatiles.org/assets/maplibre-gl/maplibre-gl.css" rel="stylesheet"/> <link href="{% settings_value "MAP_TILE_SERVER" %}/assets/maplibre-gl/maplibre-gl.css" rel="stylesheet"/>
<!-- add container for the map --> <!-- add container for the map -->
<div id="map" style="width:100%;aspect-ratio:16/9"></div> <div id="map" style="width:100%;aspect-ratio:16/9"></div>
@ -13,7 +13,7 @@
<script> <script>
let map = new maplibregl.Map({ let map = new maplibregl.Map({
container: 'map', container: 'map',
style: 'https://tiles.versatiles.org/assets/styles/colorful.json', style: '{% settings_value "MAP_TILE_SERVER" %}/assets/styles/colorful.json',
center: [10.49, 50.68], center: [10.49, 50.68],
zoom: 5 zoom: 5
}).addControl(new maplibregl.NavigationControl()); }).addControl(new maplibregl.NavigationControl());

View File

@ -55,3 +55,7 @@ def pointdecimal(value):
return f"{float(value):.9f}" return f"{float(value):.9f}"
except ValueError: except ValueError:
return value return value
@register.simple_tag
def settings_value(name):
return getattr(settings, name)

View File

@ -81,6 +81,9 @@ LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')]
""" GEOCODING """ """ GEOCODING """
GEOCODING_API_URL = config.get("geocoding", "api_url", fallback="https://nominatim.hyteck.de/search") GEOCODING_API_URL = config.get("geocoding", "api_url", fallback="https://nominatim.hyteck.de/search")
""" Tile Server """
MAP_TILE_SERVER = config.get("map", "tile_server", fallback="https://tiles.hyteck.de")
""" OxiTraffic""" """ OxiTraffic"""
OXITRAFFIC_ENABLED = config.get("tracking", "oxitraffic_enabled", fallback=False) OXITRAFFIC_ENABLED = config.get("tracking", "oxitraffic_enabled", fallback=False)