-
-
Notifications
You must be signed in to change notification settings - Fork 77
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 support for xyzservices #654
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments
These variables correspond to three different formats for specifying the spatial | ||
location and zoom level of the requested tiles: | ||
|
||
* Web mapping tiles sources containing {x}, {y}, and {z} variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little confused by this change. You are changing the WMTS
class to contain WMTS
, QUADKEY
, and BBox
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, it already supported all those; it just wasn't documented.
geoviews/geoviews/plotting/bokeh/__init__.py
Lines 52 to 56 in ec245c7
tile_source = QUADKEYTileSource | |
elif all(kw in element.data.upper() for kw in ('{XMIN}', '{XMAX}', '{YMIN}', '{YMAX}')): | |
tile_source = BBoxTileSource | |
elif all(kw in element.data.upper() for kw in ('{X}', '{Y}', '{Z}')): | |
tile_source = WMTSTileSource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geoviews/geoviews/plotting/mpl/__init__.py
Lines 474 to 511 in ec245c7
class WMTSPlot(GeoPlot): | |
""" | |
Adds a Web Map Tile Service from a WMTS Element. | |
""" | |
zoom = param.Integer(default=8, doc=""" | |
Controls the zoom level of the tile source.""") | |
style_opts = ['alpha', 'cmap', 'interpolation', 'visible', | |
'filterrad', 'clims', 'norm'] | |
def get_data(self, element, ranges, style): | |
if isinstance(element.data, str): | |
if '{Q}' in element.data: | |
tile_source = QuadtreeTiles(url=element.data) | |
else: | |
tile_source = GoogleTiles(url=element.data) | |
return (tile_source, self.zoom), style, {} | |
else: | |
tile_source = element.data | |
return (tile_source, element.layer), style, {} | |
def init_artists(self, ax, plot_args, plot_kwargs): | |
if isinstance(plot_args[0], GoogleTiles): | |
if 'artist' in self.handles: | |
return {'artist': self.handles['artist']} | |
img = ax.add_image(*plot_args, **plot_kwargs) | |
return {'artist': img or plot_args[0]} | |
return {'artist': ax.add_wmts(*plot_args, **plot_kwargs)} | |
def teardown_handles(self): | |
""" | |
If no custom update_handles method is supplied this method | |
is called to tear down any previous handles before replacing | |
them. | |
""" | |
if not isinstance(self.handles.get('artist'), GoogleTiles): | |
self.handles['artist'].remove() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, it already supported all those; it just wasn't documented.
Isn't this something you added to this PR?
It just doesn't make sense to me to have a specific name for the class and then support more general cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this PR only adds support for XYZServices' classes (the package).
Yes, I understand that, but it'd be breaking change if we separated those out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, this URL uses BBoxTileSource
and all I'm using is gv.WMTS
radar_url_fmt = """
https://idpgis.ncep.noaa.gov/arcgis/services/radar/radar_base_reflectivity_time/ImageServer/WMSServer?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetMap
&FORMAT=image/png
&TRANSPARENT=true
&WIDTH=256
&HEIGHT=256
&CRS=EPSG:3857
&BBOX={XMIN},{YMIN},{XMAX},{YMAX}
&LAYERS=0
"""
Maybe we can deprecate gv.WMTS in favor of gv.Tiles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I got confused by the way Github highlighted stuff.
I think we should think about giving it a broader name for the class (but not in this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can deprecate
gv.WMTS
in favor ofgv.Tiles
I think this would be a good idea. Let's do it in another PR.
Co-authored-by: Andrew Huang <ahuang@Andrews-MacBook-Pro.local>
Closes #517 and finishes holoviz/holoviews#5057
Based off https://github.com/holoviz/holoviews/pull/5062/files