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

Fixed WMTS update with url #89

Merged
merged 1 commit into from
Sep 29, 2017
Merged

Fixed WMTS update with url #89

merged 1 commit into from
Sep 29, 2017

Conversation

philippjfr
Copy link
Member

In previous PRs we allowed creating a WMTS element with just a URL, however the plotting code then ended up trying to replace the original tile source object. This fixes this issue.

@jbednar
Copy link
Member

jbednar commented Sep 29, 2017

Looks good to me apart from the failing test.

@philippjfr
Copy link
Member Author

Now fixed.

@jlstevens
Copy link
Contributor

Merging given the tests have passed and Jim approved this PR.

@jlstevens jlstevens merged commit 1a131cb into master Sep 29, 2017
@digitaltopo
Copy link

While following @jbednar's LandSat example I'm getting the error:

ValueError: not enough values to unpack (expected 3, got 2)

when calling tiles in the cell where we render blue band as black and white with Stamen basemap:

%opts RGB [width=600 height=600]
tiles = gv.WMTS(STAMEN_TONER)
tiles * shade(regrid(hv.Image(bands[1])), cmap=['black', 'white']).redim(x='Longitude', y='Latitude')

(same happens with just tiles by itself, without the shaded, regridded hv.Image)

Is this related?

Looking at source for geoviews.WMTS the docs seem to be cut off:

 The WMTS Element represents a Web Map Tile Service specified as a tuple of the API URL and

Can't get past this part in the example for now.

Here's the full error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
    339                 pass
    340             else:
--> 341                 return printer(obj)
    342             # Finally look for special method names
    343             method = get_real_method(obj, self.print_method)

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in pprint_display(obj)
    257     if not ip.display_formatter.formatters['text/plain'].pprint:
    258         return None
--> 259     return display(obj, raw=True)
    260 
    261 

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in display(obj, raw, **kwargs)
    237     elif isinstance(obj, (CompositeOverlay, ViewableElement)):
    238         with option_state(obj):
--> 239             html = element_display(obj)
    240     elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
    241         with option_state(obj):

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in wrapped(element)
    130         try:
    131             html = fn(element,
--> 132                       max_frames=OutputSettings.options['max_frames'])
    133 
    134             # Only want to add to the archive for one display hook...

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in element_display(element, max_frames)
    176     if renderer.fig == 'pdf':
    177         renderer = renderer.instance(fig='png')
--> 178     return renderer.html(element, fmt=renderer.fig)
    179 
    180 

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/plotting/renderer.py in html(self, obj, fmt, css, comm, **kwargs)
    256         code to initialize a Comm, if the plot supplies one.
    257         """
--> 258         plot, fmt =  self._validate(obj, fmt)
    259         figdata, _ = self(plot, fmt, **kwargs)
    260         if css is None: css = self.css

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/plotting/renderer.py in _validate(self, obj, fmt)
    192         if isinstance(obj, tuple(self.widgets.values())):
    193             return obj, 'html'
--> 194         plot = self.get_plot(obj, renderer=self)
    195 
    196         fig_formats = self.mode_formats['fig'][self.mode]

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/plotting/bokeh/renderer.py in get_plot(self_or_cls, obj, doc, renderer)
    115         combining the bokeh model with another plot.
    116         """
--> 117         plot = super(BokehRenderer, self_or_cls).get_plot(obj, renderer)
    118         if self_or_cls.mode == 'server' and doc is None:
    119             doc = curdoc()

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/plotting/renderer.py in get_plot(self_or_cls, obj, renderer)
    179             plot = self_or_cls.plotting_class(obj)(obj, renderer=renderer,
    180                                                    **plot_opts)
--> 181             plot.update(0)
    182         else:
    183             plot = obj

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/plotting/plot.py in update(self, key)
    483     def update(self, key):
    484         if len(self) == 1 and key == 0 and not self.drawn:
--> 485             return self.initialize_plot()
    486         item = self.__getitem__(key)
    487         self.traverse(lambda x: setattr(x, '_updated', True))

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py in initialize_plot(self, ranges, plot, plots, source)
    781         self.handles['plot'] = plot
    782 
--> 783         self._init_glyphs(plot, element, ranges, source)
    784         if not self.overlaid:
    785             self._update_plot(key, plot, style_element)

~/.applications/anaconda3/envs/my-env/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py in _init_glyphs(self, plot, element, ranges, source)
    732         else:
    733             style = self.style[self.cyclic_index]
--> 734             data, mapping, style = self.get_data(element, ranges, style)
    735             current_id = element._plot_id
    736         if source is None:

ValueError: not enough values to unpack (expected 3, got 2)
holoviews:  1.9.0
heoviews: 1.3.2
bokeh: 0.12.10
python: 3.6 on anaconda3 

Thanks for your help!

@philippjfr
Copy link
Member Author

@digitaltopo Please upgrade to geoviews 1.4.0 with conda install -c holoviews geoviews

@digitaltopo
Copy link

Thanks for your reply! Upgrading took care of the issue!
I wasn't seeing the 1.4.0 release through conda but instead upgraded using pip from the git tag:

pip install git+https://github.com/ioam/geoviews.git@1.4.0 --upgrade

@philippjfr philippjfr deleted the wmts_url_fix branch January 13, 2018 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants