Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically convert lonlat to xy when tiles=True #1377

Merged
merged 9 commits into from
Sep 13, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion hvplot/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from holoviews.plotting.util import process_cmap
from holoviews.operation import histogram, apply_when
from holoviews.streams import Buffer, Pipe
from holoviews.util.transform import dim
from holoviews.util.transform import dim, lon_lat_to_easting_northing
from pandas import DatetimeIndex, MultiIndex

from .backend_transforms import _transfer_opts_cur_backend
Expand Down Expand Up @@ -587,6 +587,21 @@ def __init__(
autorange=None,
**kwds,
):
if geo and tiles and not crs and not projection:
# tiles without requiring geoviews/cartopy
# check if between -180 and 360 and lat between -90 and 90
min_x = np.min(data[x])
max_x = np.max(data[x])
min_y = np.min(data[y])
max_y = np.max(data[y])
if -180 < min_x < 360 and -180 < max_x < 360 and -90 < min_y < 90 and -90 < max_y < 90:
data = data.copy()
lons, lats = data[x], data[y]
easting, northing = lon_lat_to_easting_northing(lons, lats)
data[x] = easting
data[y] = northing
geo = False

# Process data and related options
self._redim = fields
self.use_index = use_index
Expand Down
Loading