From f28f034607731af642957c663496f3f478e828d5 Mon Sep 17 00:00:00 2001 From: Hendrik Huyskens Date: Mon, 6 May 2024 19:31:28 +0200 Subject: [PATCH] Fix popups for distilled layers --- CHANGELOG.md | 1 + config/settings/base.py | 7 ++++--- digiplan/map/views.py | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3df85658..e79b1904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project tries to adhere to [Semantic Versioning](https://semver.org/spe - top wizard layout - municipality borders and labels - show potential layers if detail panel is open when revisiting settings menu +- popups for distilled layers ## [0.1.0] - 2024-03-19 ### Added diff --git a/config/settings/base.py b/config/settings/base.py index 25bba274..fffe0233 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -281,6 +281,7 @@ def __getitem__(self, item): # noqa: D105, ANN001, ANN204 MAP_ENGINE_X_OFFSET = 1 # Defines how many tiles to the right are added at first level MAP_ENGINE_Y_OFFSET = 1 # Defines how many tiles to the bottom are added at first level MAP_ENGINE_MAX_DISTILLED_ZOOM = 13 +DISTILL = env.bool("MAP_ENGINE_USE_DISTILLED_MVTS", False) MAP_ENGINE_IMAGES = [ setup.MapImage("wind", "images/icons/map_wind.png"), @@ -541,15 +542,15 @@ def __getitem__(self, item): # noqa: D105, ANN001, ANN204 popup_at_default_layer=True, ), setup.Popup( - "rpg_ols_pv_ground_operating", + f"rpg_ols_pv_ground_operating{'_distilled' if DISTILL else ''}", popup_at_default_layer=True, ), setup.Popup( - "rpg_ols_pv_ground_approved", + f"rpg_ols_pv_ground_approved{'_distilled' if DISTILL else ''}", popup_at_default_layer=True, ), setup.Popup( - "rpg_ols_pv_ground_planned", + f"rpg_ols_pv_ground_planned{'_distilled' if DISTILL else ''}", popup_at_default_layer=True, ), setup.Popup( diff --git a/digiplan/map/views.py b/digiplan/map/views.py index 9cfbe14b..90b9a41f 100644 --- a/digiplan/map/views.py +++ b/digiplan/map/views.py @@ -126,6 +126,7 @@ def get_popup(request: HttpRequest, lookup: str, region: int) -> response.JsonRe containing HTML to render popup and chart options to be used in E-Chart. """ map_state = request.GET.dict() + lookup = lookup.removesuffix("_distilled") popup = popups.POPUPS[lookup](lookup, region, map_state=map_state) return popup.render()