From 5bd4fc83d92a539c1f2242ec6b9f9e8fe1286758 Mon Sep 17 00:00:00 2001 From: Mark Vrijlandt Date: Fri, 26 Jan 2024 16:29:35 +0100 Subject: [PATCH] Add opacity parameter to create_coverage --- geo/Geoserver.py | 3 +++ geo/Style.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/geo/Geoserver.py b/geo/Geoserver.py index ec8ecfa..87acb9e 100644 --- a/geo/Geoserver.py +++ b/geo/Geoserver.py @@ -1181,6 +1181,7 @@ def create_coveragestyle( color_ramp: str = "RdYlGn_r", cmap_type: str = "ramp", number_of_classes: int = 5, + opacity: float = 1, ): """Dynamically create style for raster. @@ -1192,6 +1193,7 @@ def create_coveragestyle( color_ramp : str cmap_type : str TODO: This should be a set of the available options : {"ramp", "linear", ... } number_of_classes : int + opacity : float overwrite : bool Notes @@ -1213,6 +1215,7 @@ def create_coveragestyle( min_value, max_value, number_of_classes, + opacity, ) style_xml = "".format( style_name, style_name + ".sld" diff --git a/geo/Style.py b/geo/Style.py index 883806d..17b14c5 100644 --- a/geo/Style.py +++ b/geo/Style.py @@ -82,7 +82,7 @@ def coverage_style_colormapentry( def coverage_style_xml( - color_ramp, style_name, cmap_type, min_value, max_value, number_of_classes + color_ramp, style_name, cmap_type, min_value, max_value, number_of_classes, opacity ): min_max_difference = max_value - min_value style_append = "" @@ -108,6 +108,7 @@ def coverage_style_xml( + {3} 1 @@ -123,7 +124,7 @@ def coverage_style_xml( """.format( - cmap_type, style_append, style_name + cmap_type, style_append, style_name, opacity ) with open("style.sld", "w") as f: