Open DmitriyLeybel opened 2 years ago
gv.Polygons
defaults to PlateCarree
, which is why both of those examples give an IndexError
. hvplot
without any inputs works because it only outputs an Holoviews plot. If you set geo=True
it will also give an IndexError
.
I think you get an IndexError because your data is projected coordinates with a geographic coordinates system.
Your solution of setting crs
looks fine to me. Alternative, you can change the CRS of the GeoDataFrame with t = t.set_crs("EPSG:3857", allow_override=True).to_crs("EPSG:4326")
(not sure if those are the correct CRS).
When #581 is merged, the error will be better.
ALL software version info
python == 3.9.13
geoviews == 1.9.5 holoviews == 1.14.8 shapely == 1.8.2 cartopy == 0.20.3 bokeh == 2.4.2 matplotlib == 3.5.1
Description of expected behavior and the observed behavior
In attempting to plot a geometry from a shape file from the census.gov repo, I'm experiencing errors when using the default crs argument(Plate Carree) of gv.Polygons. The same error persists when assigning Plate Carree as the crs to use with hvplot, when changing the plotting backend from bokeh to matplotlib, and when changing the crs with geopandas(to_crs). Other crs projections do appear to work when set in the plotting function, such as Mercator, GOOGLE_MERCATOR, and EckertII, and default hvplot method.
Complete, minimal, self-contained example code that reproduces the issue
From Notebook:
IndexError
```python IndexError Traceback (most recent call last) File ~\.conda\envs\geo\lib\site-packages\IPython\core\formatters.py:973, in MimeBundleFormatter.__call__(self, obj, include, exclude) 970 method = get_real_method(obj, self.print_method) 972 if method is not None: --> 973 return method(include=include, exclude=exclude) 974 return None 975 else: File ~\.conda\envs\geo\lib\site-packages\holoviews\core\dimension.py:1316, in Dimensioned._repr_mimebundle_(self, include, exclude) 1309 def _repr_mimebundle_(self, include=None, exclude=None): 1310 """ 1311 Resolves the class hierarchy for the class rendering the 1312 object using any display hooks registered on Store.display 1313 hooks. The output of all registered display_hooks is then 1314 combined and returned. 1315 """ -> 1316 return Store.render(self) File ~\.conda\envs\geo\lib\site-packages\holoviews\core\options.py:1405, in Store.render(cls, obj) 1403 data, metadata = {}, {} 1404 for hook in hooks: -> 1405 ret = hook(obj) 1406 if ret is None: 1407 continue File ~\.conda\envs\geo\lib\site-packages\holoviews\ipython\display_hooks.py:282, in pprint_display(obj) 280 if not ip.display_formatter.formatters['text/plain'].pprint: 281 return None --> 282 return display(obj, raw_output=True) File ~\.conda\envs\geo\lib\site-packages\holoviews\ipython\display_hooks.py:252, in display(obj, raw_output, **kwargs) 250 elif isinstance(obj, (CompositeOverlay, ViewableElement)): 251 with option_state(obj): --> 252 output = element_display(obj) 253 elif isinstance(obj, (Layout, NdLayout, AdjointLayout)): 254 with option_state(obj): File ~\.conda\envs\geo\lib\site-packages\holoviews\ipython\display_hooks.py:146, in display_hook.test_geo.zip
gv.Polygons with Mercator crs: