From 6de2ad695b2ad4bea2907a45a2a2eba259a4cae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Wed, 4 Oct 2023 15:51:09 +0200 Subject: [PATCH] Reuse existing infrastructure --- hvplot/converter.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/hvplot/converter.py b/hvplot/converter.py index 20cc2874a..a2a24894e 100644 --- a/hvplot/converter.py +++ b/hvplot/converter.py @@ -584,8 +584,6 @@ def __init__( if self.crs and global_extent: plot_opts['global_extent'] = global_extent - if projection: - plot_opts['projection'] = process_crs(projection) title = title if title is not None else getattr(self, '_title', None) if title is not None: plot_opts['title'] = title @@ -1262,12 +1260,12 @@ def method_wrapper(ds, x, y): obj = method(x, y) obj._dataset = dataset - if self.crs and self.project: - # Apply projection before rasterizing - import cartopy.crs as ccrs - from geoviews import project - projection = self._plot_opts.get('projection', ccrs.GOOGLE_MERCATOR) - obj = project(obj, projection=projection) + if self.geo and self.crs != self.output_projection: + import geoviews as gv + if isinstance(obj, gv.element.geo._Element): + obj.opts(projection=self.output_projection) + else: + obj = gv.project(obj, projection=self.output_projection) if not (self.datashade or self.rasterize or self.downsample): layers = self._apply_layers(obj) @@ -1362,10 +1360,6 @@ def method_wrapper(ds, x, y): if self._dim_ranges.get('c', (None, None)) != (None, None): style['clim'] = self._dim_ranges['c'] - if self.geo and self.crs != self.output_projection: - import geoviews as gv - obj = gv.project(obj, projection=self.output_projection) - processed = operation(obj, **opts) if self.dynspread: