Skip to content

Commit

Permalink
Back to basic
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Oct 5, 2023
1 parent 6de2ad6 commit a3e64a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions hvplot/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ def __init__(
self.dynamic = dynamic
self.geo = any([geo, crs, global_extent, projection, project, coastline, features])
self.crs = self._process_crs(data, crs) if self.geo else None
self.output_projection = self.crs
self.project = project
self.coastline = coastline
self.features = features
Expand Down Expand Up @@ -584,6 +585,8 @@ def __init__(

if self.crs and global_extent:
plot_opts['global_extent'] = global_extent
if self.crs != self.output_projection:
plot_opts['projection'] = self.output_projection
title = title if title is not None else getattr(self, '_title', None)
if title is not None:
plot_opts['title'] = title
Expand Down Expand Up @@ -1260,12 +1263,10 @@ def method_wrapper(ds, x, y):
obj = method(x, y)
obj._dataset = dataset

if self.geo and self.crs != self.output_projection:
if self.geo and self.project:
# Apply projection before rasterizing
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)
obj = gv.project(obj, projection=self.output_projection)

if not (self.datashade or self.rasterize or self.downsample):
layers = self._apply_layers(obj)
Expand Down
1 change: 1 addition & 0 deletions hvplot/tests/testgeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def test_geo_with_rasterize(self):
rasterize=True,
dynamic=False,
aggregator="max",
project=True,
)

p1 = gv.Points(ds.isel(time=0), kdims=["lon", "lat"], crs=ccrs.PlateCarree())
Expand Down

0 comments on commit a3e64a8

Please sign in to comment.