Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load map url from django settings #544

Merged
merged 1 commit into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bplan/assets/js/app/components/map/mapControllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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')) {
Expand Down
1 change: 1 addition & 0 deletions bplan/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<script type="text/javascript">
area = "{% block area %}{% endblock %}";
afs_behoer = "{{ afs_behoer }}";
map_baseurl = "{{ map_baseurl }}";
</script>
</head>

Expand Down
26 changes: 12 additions & 14 deletions bplan/views.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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


Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions django_zbp/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"