From 798b6a37ef751503fd7732439594763f920d71d5 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 21 May 2024 11:59:53 +1000 Subject: [PATCH] Fix conversion of scale ranges with varying styles --- felt/core/fsl_converter.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/felt/core/fsl_converter.py b/felt/core/fsl_converter.py index 632a2ea..6c7bb96 100644 --- a/felt/core/fsl_converter.py +++ b/felt/core/fsl_converter.py @@ -220,13 +220,25 @@ def vector_layer_to_fsl( if layer.hasScaleBasedVisibility(): if layer.minimumScale(): - fsl['style']['minZoom'] = ( - MapUtils.map_scale_to_leaflet_tile_zoom( - layer.minimumScale())) + if isinstance(fsl['style'], list): + for style in fsl['style']: + style['minZoom'] = ( + MapUtils.map_scale_to_leaflet_tile_zoom( + layer.minimumScale())) + else: + fsl['style']['minZoom'] = ( + MapUtils.map_scale_to_leaflet_tile_zoom( + layer.minimumScale())) if layer.maximumScale(): - fsl['style']['maxZoom'] = ( - MapUtils.map_scale_to_leaflet_tile_zoom( - layer.maximumScale())) + if isinstance(fsl['style'], list): + for style in fsl['style']: + style['maxZoom'] = ( + MapUtils.map_scale_to_leaflet_tile_zoom( + layer.maximumScale())) + else: + fsl['style']['maxZoom'] = ( + MapUtils.map_scale_to_leaflet_tile_zoom( + layer.maximumScale())) return fsl