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

Add max zoom default #745

Merged
merged 7 commits into from
Sep 9, 2024
Merged

Add max zoom default #745

merged 7 commits into from
Sep 9, 2024

Conversation

ahuang11
Copy link
Collaborator

@ahuang11 ahuang11 commented Sep 8, 2024

Closes #744

image

Unfortunately, I couldn't target OSM specifically; all the combinations I tried:

options.TilePlot.OSM = Options('style', max_zoom=10)
options.TilePlot.Osm = Options('style', max_zoom=10)
options.WMTS.Osm = Options('style', max_zoom=10)
options.WMTS.OSM = Options('style', max_zoom=10)
options.Wmts.OSM = Options('style', max_zoom=10)
options.Wmts.Osm = Options('style', max_zoom=10)
options.TileSources.OSM = Options('style', max_zoom=10)
options.Tile_Sources.OSM = Options('style', max_zoom=10)
options.Tile_Sources.OSM = Options('style', max_zoom=10)
options.TileSources.Osm = Options('style', max_zoom=10)

@ahuang11 ahuang11 requested a review from hoxbro September 8, 2024 21:40
@hoxbro
Copy link
Member

hoxbro commented Sep 9, 2024

To only change max_zoom of OSM, we can do something like this:

diff --git a/geoviews/plotting/bokeh/__init__.py b/geoviews/plotting/bokeh/__init__.py
index 6a2c16c..6956152 100644
--- a/geoviews/plotting/bokeh/__init__.py
+++ b/geoviews/plotting/bokeh/__init__.py
@@ -49,7 +49,7 @@ from ...operation import (
     project_quadmesh,
     project_vectorfield,
 )
-from ...tile_sources import _ATTRIBUTIONS
+from ...tile_sources import _ATTRIBUTIONS, OSM
 from ...util import line_types, poly_types
 from . import callbacks  # noqa
 from .plot import GeoOverlayPlot, GeoPlot
@@ -60,6 +60,9 @@ except ImportError:
     class ImageStackPlot:
         ...
 
+_TILE_MAX_ZOOM = {OSM: 19}
+
+
 class TilePlot(GeoPlot):
 
     style_opts = [
@@ -102,6 +105,8 @@ class TilePlot(GeoPlot):
                                 'Must contain {X}/{Y}/{Z}, {XMIN}/{XMAX}/{YMIN}/{YMAX} '
                                 'or {Q} template strings.')
             params = {'url': element.data}
+            if element in _TILE_MAX_ZOOM:
+                params['max_zoom'] = _TILE_MAX_ZOOM[element]
             for zoom in ('min_zoom', 'max_zoom'):
                 if zoom in style:
                     params[zoom] = style[zoom]

@ahuang11
Copy link
Collaborator Author

ahuang11 commented Sep 9, 2024

Test will fail due to rc mismatch, but tested the new test and it's ready to merge (I don't have permissions) and added to the changelog.

@ahuang11 ahuang11 merged commit 58a9e7d into main Sep 9, 2024
3 of 10 checks passed
@ahuang11 ahuang11 deleted the add_max_zoom_default branch September 9, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Too close of Points will not show tiles on init until zoom out
2 participants