Software version info:
geoviews=1.9.5
holoviews=1.15.3
bokeh=2.4.3
python=3.8.15
jupyterlab=3.5.2
shapely=2.0.0
I can plot every other feature geometry just fine in my notebook but just gf.states
as a singular command in its own cell throws an error from trying to iterate through a MultiPolygon:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/IPython/core/formatters.py:972, in MimeBundleFormatter.__call__(self, obj, include, exclude)
969 method = get_real_method(obj, self.print_method)
971 if method is not None:
--> 972 return method(include=include, exclude=exclude)
973 return None
974 else:
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/core/dimension.py:1293, in Dimensioned._repr_mimebundle_(self, include, exclude)
1286 def _repr_mimebundle_(self, include=None, exclude=None):
1287 """
1288 Resolves the class hierarchy for the class rendering the
1289 object using any display hooks registered on Store.display
1290 hooks. The output of all registered display_hooks is then
1291 combined and returned.
1292 """
-> 1293 return Store.render(self)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/core/options.py:1426, in Store.render(cls, obj)
1424 data, metadata = {}, {}
1425 for hook in hooks:
-> 1426 ret = hook(obj)
1427 if ret is None:
1428 continue
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py:277, in pprint_display(obj)
275 if not ip.display_formatter.formatters['text/plain'].pprint:
276 return None
--> 277 return display(obj, raw_output=True)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py:247, in display(obj, raw_output, **kwargs)
245 elif isinstance(obj, (CompositeOverlay, ViewableElement)):
246 with option_state(obj):
--> 247 output = element_display(obj)
248 elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
249 with option_state(obj):
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py:141, in display_hook.<locals>.wrapped(element)
139 try:
140 max_frames = OutputSettings.options['max_frames']
--> 141 mimebundle = fn(element, max_frames=max_frames)
142 if mimebundle is None:
143 return {}, {}
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py:187, in element_display(element, max_frames)
184 if type(element) not in Store.registry[backend]:
185 return None
--> 187 return render(element)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py:68, in render(obj, **kwargs)
65 if renderer.fig == 'pdf':
66 renderer = renderer.instance(fig='png')
---> 68 return renderer.components(obj, **kwargs)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/plotting/renderer.py:398, in Renderer.components(self, obj, fmt, comm, **kwargs)
395 embed = (not (dynamic or streams or self.widget_mode == 'live') or config.embed)
397 if embed or config.comms == 'default':
--> 398 return self._render_panel(plot, embed, comm)
399 return self._render_ipywidget(plot)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/plotting/renderer.py:405, in Renderer._render_panel(self, plot, embed, comm)
403 doc = Document()
404 with config.set(embed=embed):
--> 405 model = plot.layout._render_model(doc, comm)
406 if embed:
407 return render_model(model, comm)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/panel/viewable.py:508, in Renderable._render_model(self, doc, comm)
506 if comm is None:
507 comm = state._comm_manager.get_server_comm()
--> 508 model = self.get_root(doc, comm)
510 if config.embed:
511 embed_state(self, model, doc,
512 json=config.embed_json,
513 json_prefix=config.embed_json_prefix,
514 save_path=config.embed_save_path,
515 load_path=config.embed_load_path,
516 progress=False)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/panel/viewable.py:559, in Renderable.get_root(self, doc, comm, preprocess)
542 """
543 Returns the root model and applies pre-processing hooks
544
(...)
556 Returns the bokeh model corresponding to this panel object
557 """
558 doc = init_doc(doc)
--> 559 root = self._get_model(doc, comm=comm)
560 if preprocess:
561 self._preprocess(root)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/panel/layout/base.py:146, in Panel._get_model(self, doc, root, parent, comm)
144 if root is None:
145 root = model
--> 146 objects = self._get_objects(model, [], doc, root, comm)
147 props = dict(self._init_params(), objects=objects)
148 model.update(**self._process_param_change(props))
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/panel/layout/base.py:131, in Panel._get_objects(self, model, old_objects, doc, root, comm)
129 else:
130 try:
--> 131 child = pane._get_model(doc, root, model, comm)
132 except RerenderError:
133 return self._get_objects(model, current_objects[:i], doc, root, comm)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/panel/pane/holoviews.py:265, in HoloViews._get_model(self, doc, root, parent, comm)
263 plot = self.object
264 else:
--> 265 plot = self._render(doc, comm, root)
267 plot.pane = self
268 backend = plot.renderer.backend
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/panel/pane/holoviews.py:342, in HoloViews._render(self, doc, comm, root)
339 if comm:
340 kwargs['comm'] = comm
--> 342 return renderer.get_plot(self.object, **kwargs)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/plotting/bokeh/renderer.py:70, in BokehRenderer.get_plot(self_or_cls, obj, doc, renderer, **kwargs)
63 @bothmethod
64 def get_plot(self_or_cls, obj, doc=None, renderer=None, **kwargs):
65 """
66 Given a HoloViews Viewable return a corresponding plot instance.
67 Allows supplying a document attach the plot to, useful when
68 combining the bokeh model with another plot.
69 """
---> 70 plot = super().get_plot(obj, doc, renderer, **kwargs)
71 if plot.document is None:
72 plot.document = Document() if self_or_cls.notebook_context else curdoc()
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/plotting/renderer.py:240, in Renderer.get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
237 defaults = [kd.default for kd in plot.dimensions]
238 init_key = tuple(v if d is None else d for v, d in
239 zip(plot.keys[0], defaults))
--> 240 plot.update(init_key)
241 else:
242 plot = obj
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/plotting/plot.py:948, in DimensionedPlot.update(self, key)
946 def update(self, key):
947 if len(self) == 1 and ((key == 0) or (key == self.keys[0])) and not self.drawn:
--> 948 return self.initialize_plot()
949 item = self.__getitem__(key)
950 self.traverse(lambda x: setattr(x, '_updated', True))
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/geoviews/plotting/bokeh/plot.py:111, in GeoPlot.initialize_plot(self, ranges, plot, plots, source)
109 def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
110 opts = {} if isinstance(self, HvOverlayPlot) else {'source': source}
--> 111 fig = super(GeoPlot, self).initialize_plot(ranges, plot, plots, **opts)
112 if self.geographic and self.show_bounds and not self.overlaid:
113 from . import GeoShapePlot
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/plotting/bokeh/element.py:1397, in ElementPlot.initialize_plot(self, ranges, plot, plots, source)
1394 self.handles['y_range'] = plot.y_range
1395 self.handles['plot'] = plot
-> 1397 self._init_glyphs(plot, element, ranges, source)
1398 if not self.overlaid:
1399 self._update_plot(key, plot, style_element)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/plotting/bokeh/element.py:1341, in ElementPlot._init_glyphs(self, plot, element, ranges, source)
1339 else:
1340 style = self.style[self.cyclic_index]
-> 1341 data, mapping, style = self.get_data(element, ranges, style)
1342 current_id = element._plot_id
1344 with abbreviated_exception():
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/geoviews/plotting/bokeh/__init__.py:237, in FeaturePlot.get_data(self, element, ranges, style)
235 el_type = Polygons
236 polys = el_type(geoms, crs=element.crs, **util.get_param_values(element))
--> 237 return super(FeaturePlot, self).get_data(polys, ranges, style)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/geoviews/plotting/bokeh/plot.py:170, in GeoPlot.get_data(self, element, ranges, style)
168 def get_data(self, element, ranges, style):
169 if self._project_operation and self.geographic:
--> 170 element = self._project_operation(element, projection=self.projection)
171 return super(GeoPlot, self).get_data(element, ranges, style)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/param/parameterized.py:3658, in ParameterizedFunction.__new__(class_, *args, **params)
3656 inst = class_.instance()
3657 inst.param._set_name(class_.__name__)
-> 3658 return inst.__call__(*args,**params)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/core/operation.py:220, in Operation.__call__(self, element, **kwargs)
218 kwargs['link_dataset'] = self._propagate_dataset
219 kwargs['link_inputs'] = self.p.link_inputs
--> 220 return element.apply(self, **kwargs)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/core/accessors.py:45, in AccessorPipelineMeta.pipelined.<locals>.pipelined_call(*args, **kwargs)
42 inst._obj._in_method = True
44 try:
---> 45 result = __call__(*args, **kwargs)
47 if not in_method:
48 init_op = factory.instance(
49 output_type=type(inst),
50 kwargs={'mode': getattr(inst, 'mode', None)},
51 )
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/core/accessors.py:202, in Apply.__call__(self, apply_function, streams, link_inputs, link_dataset, dynamic, per_element, **kwargs)
200 if hasattr(apply_function, 'dynamic'):
201 inner_kwargs['dynamic'] = False
--> 202 new_obj = apply_function(self._obj, **inner_kwargs)
203 if (link_dataset and isinstance(self._obj, Dataset) and
204 isinstance(new_obj, Dataset) and new_obj._dataset is None):
205 new_obj._dataset = self._obj.dataset
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/core/operation.py:214, in Operation.__call__(self, element, **kwargs)
210 return element.clone([(k, self._apply(el, key=k))
211 for k, el in element.items()])
212 elif ((self._per_element and isinstance(element, Element)) or
213 (not self._per_element and isinstance(element, ViewableElement))):
--> 214 return self._apply(element)
215 elif 'streams' not in kwargs:
216 kwargs['streams'] = self.p.streams
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/core/operation.py:141, in Operation._apply(self, element, key)
139 if not in_method:
140 element._in_method = True
--> 141 ret = self._process(element, key)
142 if hasattr(element, '_in_method') and not in_method:
143 element._in_method = in_method
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/geoviews/operation/projection.py:40, in _project_operation._process(self, element, key)
39 def _process(self, element, key=None):
---> 40 return element.map(self._process_element, self.supported_types)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/core/data/__init__.py:204, in PipelineMeta.pipelined.<locals>.pipelined_fn(*args, **kwargs)
201 inst._in_method = True
203 try:
--> 204 result = method_fn(*args, **kwargs)
205 if PipelineMeta.disable:
206 return result
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/core/data/__init__.py:1216, in Dataset.map(self, *args, **kwargs)
1214 @wraps(LabelledData.map)
1215 def map(self, *args, **kwargs):
-> 1216 return super(Dataset, self).map(*args, **kwargs)
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/holoviews/core/dimension.py:700, in LabelledData.map(self, map_fn, specs, clone)
698 return deep_mapped
699 else:
--> 700 return map_fn(self) if applies else self
File /storage/work/c/cnd5285/mambaforge/envs/uviz/lib/python3.8/site-packages/geoviews/operation/projection.py:79, in project_path._process_element(self, element)
77 continue
78 elif isinstance(geom, MultiPolygon):
---> 79 polys = [g for g in geom if g.area > 1e-15]
80 if not polys:
81 continue
TypeError: 'MultiPolygon' object is not iterable