From 6e63d831e93017e7aa55264aee6173b16f043c26 Mon Sep 17 00:00:00 2001 From: Julian Dehm Date: Wed, 26 Apr 2023 14:07:01 +0200 Subject: [PATCH] load map url from django settings * use new tile server --- .../js/app/components/map/mapControllers.js | 3 ++- bplan/templates/base.html | 1 + bplan/views.py | 26 +++++++++---------- django_zbp/settings/base.py | 1 + 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/bplan/assets/js/app/components/map/mapControllers.js b/bplan/assets/js/app/components/map/mapControllers.js index 64971fac..ba355daa 100644 --- a/bplan/assets/js/app/components/map/mapControllers.js +++ b/bplan/assets/js/app/components/map/mapControllers.js @@ -5,6 +5,7 @@ angular.module('app.map.controllers', []) .controller('MapController', ['$scope', '$rootScope', '$window', '$timeout', 'PlacesService', function($scope, $rootScope, $window, $timeout, PlacesService) { $scope.places = PlacesService; + $scope.baseurl = map_baseurl; $scope.polygons = {}; $scope.polygons.aul = {}; $scope.polygons.bbg = {}; @@ -132,7 +133,7 @@ angular.module('app.map.controllers', []) }); var token = '9aVUrssbx7PKNUKo3WtXY6MqETI6Q336u5D142QS' var colouredMap = L.mapboxGL({ - style: 'https://maps.berlinonline.de/styles/klokantech-basic/style.json', + style: $scope.baseurl, maxZoom: 19, transformRequest: function (url, resourceType) { if(resourceType === 'Tile' && 0 === url.indexOf('https://maps')) { diff --git a/bplan/templates/base.html b/bplan/templates/base.html index 2361d5df..f047aa0f 100644 --- a/bplan/templates/base.html +++ b/bplan/templates/base.html @@ -17,6 +17,7 @@ diff --git a/bplan/views.py b/bplan/views.py index d60c45b7..8e257dc7 100644 --- a/bplan/views.py +++ b/bplan/views.py @@ -1,22 +1,18 @@ -from django.views.generic.detail import DetailView -from .models import Bezirk -from .models import Download -from .forms import LoginForm -from django.core.management import call_command -from django.contrib.auth import authenticate +from django.conf import settings from django.contrib.auth import login from django.contrib.auth import logout -from django.shortcuts import render -from django.shortcuts import Http404 -from django.shortcuts import render -from django.shortcuts import redirect -from django.shortcuts import get_object_or_404 -from django.template import RequestContext -from django.http import HttpResponseRedirect, HttpResponse from django.contrib.auth.decorators import login_required +from django.core.management import call_command +from django.http import HttpResponseRedirect +from django.shortcuts import render from django.urls import reverse -from django.views.generic import TemplateView from django.views.decorators.clickjacking import xframe_options_exempt +from django.views.generic import TemplateView +from django.views.generic.detail import DetailView + +from .forms import LoginForm +from .models import Bezirk +from .models import Download class BezirkDetailView(DetailView): @@ -29,6 +25,7 @@ def dispatch(self, *args, **kwargs): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['afs_behoer'] = self.request.GET.get('afs_behoer', '') + context['map_baseurl'] = settings.MAP_BASEURL return context @@ -39,6 +36,7 @@ def dispatch(self, *args, **kwargs): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) + context['map_baseurl'] = settings.MAP_BASEURL context['afs_behoer'] = self.request.GET.get('afs_behoer', '') return context diff --git a/django_zbp/settings/base.py b/django_zbp/settings/base.py index e623d881..c8a255d4 100644 --- a/django_zbp/settings/base.py +++ b/django_zbp/settings/base.py @@ -132,3 +132,4 @@ # Allow Cross-Origin Resource Sharing only for address lookups CORS_ORIGIN_ALLOW_ALL = True CORS_URLS_REGEX = r'^/api/addresses/.*$' +MAP_BASEURL = "https://basemap.berlin.de/gdz_basemapde_vektor/styles/bm_web_col.json"