Repository: holoviz/hvplot

Issue:
GDAL 4.0 warning from osgeo
Running this:

```
import hvplot.xarray
import rioxarray as rxr

# Downloaded from: https://oin-hotosm.s3.amazonaws.com/5d7dad0becaf880008a9bc88/0/5d7dad0becaf880008a9bc89.tif
cog_url = "/home/shh/Downloads/5d7dad0becaf880008a9bc89.tif"
da = rxr.open_rasterio(cog_url)
plot = da.hvplot.rgb(x="x", y="y", rasterize=True, projection="Robinson")
plot
```

I'm getting this warning:
`/home/shh/miniconda3/envs/holoviz/lib/python3.11/site-packages/osgeo/osr.py:385: FutureWarning: Neither osr.UseExceptions() nor osr.DontUseExceptions() has been explicitly called. In GDAL 4.0, exceptions will be enabled by default.`

This should be looked into, and check which setting we should use. 



Discussion:

Resolving patch:
diff --git a/hvplot/ui.py b/hvplot/ui.py
--- a/hvplot/ui.py
+++ b/hvplot/ui.py
@@ -410,7 +410,7 @@ def __init__(self, df, **params):
             cls.name.lower(): cls(df, explorer=self, **cparams)
             for cls, cparams in controller_params.items()
         }
-        self.param.set_param(**self._controllers)
+        self.param.update(**self._controllers)
         self.param.watch(self._plot, list(self.param))
         for controller in self._controllers.values():
             controller.param.watch(self._plot, list(controller.param))
@@ -478,7 +478,7 @@ def _plot(self, *events):
             self._layout[1][1] = self._hvpane
             self._alert.visible = False
         except Exception as e:
-            self._alert.param.set_param(
+            self._alert.param.update(
                 object=f'**Rendering failed with following error**: {e}',
                 visible=True
             )
diff --git a/hvplot/util.py b/hvplot/util.py
--- a/hvplot/util.py
+++ b/hvplot/util.py
@@ -135,11 +135,21 @@ def proj_to_cartopy(proj):
 
     srs = proj.srs
     if has_gdal:
-        # this is more robust, as srs could be anything (espg, etc.)
-        s1 = osr.SpatialReference()
-        s1.ImportFromProj4(proj.srs)
-        if s1.ExportToProj4():
-            srs = s1.ExportToProj4()
+        import warnings
+        with warnings.catch_warnings():
+            # Avoiding this warning could be done by setting osr.UseExceptions(),
+            # except there might be a risk to break the code of users leveraging
+            # GDAL on their side or through other libraries. So we just silence it.
+            warnings.filterwarnings('ignore', category=FutureWarning, message=
+                r'Neither osr\.UseExceptions\(\) nor osr\.DontUseExceptions\(\) has '
+                r'been explicitly called\. In GDAL 4\.0, exceptions will be enabled '
+                'by default'
+            )
+            # this is more robust, as srs could be anything (espg, etc.)
+            s1 = osr.SpatialReference()
+            s1.ImportFromProj4(proj.srs)
+            if s1.ExportToProj4():
+                srs = s1.ExportToProj4()
 
     km_proj = {'lon_0': 'central_longitude',
                'lat_0': 'central_latitude',


Test patch:
diff --git a/hvplot/tests/testui.py b/hvplot/tests/testui.py
--- a/hvplot/tests/testui.py
+++ b/hvplot/tests/testui.py
@@ -23,7 +23,7 @@ def test_explorer_basic():
 def test_explorer_settings():
     explorer = hvplot.explorer(df)
 
-    explorer.param.set_param(
+    explorer.param.update(
         kind='scatter',
         x='bill_length_mm',
         y_multi=['bill_depth_mm'],
@@ -43,7 +43,7 @@ def test_explorer_settings():
 def test_explorer_plot_code():
     explorer = hvplot.explorer(df)
 
-    explorer.param.set_param(
+    explorer.param.update(
         kind='scatter',
         x='bill_length_mm',
         y_multi=['bill_depth_mm'],
@@ -62,7 +62,7 @@ def test_explorer_plot_code():
 def test_explorer_hvplot():
     explorer = hvplot.explorer(df)
 
-    explorer.param.set_param(
+    explorer.param.update(
         kind='scatter',
         x='bill_length_mm',
         y_multi=['bill_depth_mm'],
@@ -78,7 +78,7 @@ def test_explorer_hvplot():
 def test_explorer_save(tmp_path):
     explorer = hvplot.explorer(df)
 
-    explorer.param.set_param(
+    explorer.param.update(
         kind='scatter',
         x='bill_length_mm',
         y_multi=['bill_depth_mm'],