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

Allow to wheel zoom on a world map #389

Closed
fmaussion opened this issue Nov 23, 2019 · 5 comments · Fixed by #390
Closed

Allow to wheel zoom on a world map #389

fmaussion opened this issue Nov 23, 2019 · 5 comments · Fixed by #390
Labels

Comments

@fmaussion
Copy link

Software version info

bokeh 1.4.0
geoviews 1.6.5
holoviews 1.12.6
datashader 0.8.0

Description of expected behavior and the observed behavior

Creating a map with the mwe below leads to a plot that cannot be zoomed with the wheel

Complete, minimal, self-contained example code that reproduces the issue

import pandas as pd
import numpy as np
import geoviews as gv
import cartopy.crs as ccrs
import datashader as ds
from holoviews.operation.datashader import rasterize
import bokeh
import holoviews as hv
hv.extension('bokeh')

data = pd.DataFrame()
data['CenLon'] = np.random.random_sample(200000) * 360 - 180
data['CenLat'] = np.random.random_sample(200000) * 180 - 90
data['area'] = np.random.random_sample(200000) * 1000
data = gv.Points(data, [('CenLon', 'Longitude'), ('CenLat', 'Latitude')], [('area', 'Area')])
data = gv.Dataset(gv.operation.project_points(data))

geo_kw    = dict(aggregator=ds.sum('area'), x_sampling=1000, y_sampling=1000)
geo_opts  = dict(dict(height=520, width=715), projection=ccrs.GOOGLE_MERCATOR)
static_geo = rasterize(gv.Points(data, crs=ccrs.PlateCarree).options(alpha=1), **geo_kw)
static_geo = static_geo.options(alpha=0.1, active_tools=['wheel_zoom'], **geo_opts) 

gv.tile_sources.ESRI * static_geo

I believe this must be a relatively new bug, as I think this did not affect us earlier. (the app where it doesn't work is our glacier explorer app

@philippjfr
Copy link
Member

I think this is a twofold bug, geoviews sets the maximum map extent to be the extent of the coordinate system. The tile source adjusts that and then bokeh does not allow any zooming because you've gone past the maximum extent. We should probably disable the maximum extent setting in geoviews until bokeh allows zooming in when you've gone beyond it.

@fmaussion
Copy link
Author

Thank! Is there a workaround for now?

@jbednar
Copy link
Member

jbednar commented Nov 23, 2019

I assume you can explicitly set an extent that is the minimum of the coordinate system and the tile source's extents.

@fmaussion fmaussion changed the title wheel zoom not working with datashader on a map Allow to wheel zoom on a world map Nov 24, 2019
@fmaussion
Copy link
Author

Thanks! Yes OK, the zoom in and out is actually working once one zoomed in with box zoom. But then still, the zoom out is bloked when one of the edges touches the global map borders, making it not super intuitive. But that's not a big deal, I'll just disable it for now and what for a fix upstream. Thanks for all your help!

@philippjfr
Copy link
Member

I'll probably just push a new release today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants