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 %}
<!-- add MapLibre JavaScript and CSS -->
<script src="https://tiles.versatiles.org/assets/maplibre-gl/maplibre-gl.js"></script>
<link href="https://tiles.versatiles.org/assets/maplibre-gl/maplibre-gl.css" rel="stylesheet"/>
<script src="{% settings_value "MAP_TILE_SERVER" %}/assets/maplibre-gl/maplibre-gl.js"></script>
<link href="{% settings_value "MAP_TILE_SERVER" %}/assets/maplibre-gl/maplibre-gl.css" rel="stylesheet"/>
<!-- add container for the map -->
<div id="map" style="width:100%;aspect-ratio:16/9"></div>
@ -13,7 +13,7 @@
<script>
let map = new maplibregl.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],
zoom: 5
}).addControl(new maplibregl.NavigationControl());

View File

@ -55,3 +55,7 @@ def pointdecimal(value):
return f"{float(value):.9f}"
except ValueError:
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_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_ENABLED = config.get("tracking", "oxitraffic_enabled", fallback=False)