Open poplarShift opened 5 years ago
hv and gv differ in their assumptions about coordinate systems. Specifically, hv doesn't declare any coordinate information at all, which is fine if your data is already in the coordinate system you will use to display it, but otherwise problematic. gv assumes that your data is in lat, lon unless otherwise specified, and will convert the coordinate system as needed. So maybe you need to declare an explicit non-lat,lon coordinate system for gv?
Well, that is a bit confusing given that the dataframe above has a geometry
column, not explicit lon/lat coordinates, but still using hv.Dataset achieves exactly what I want, while the "native" geoviews version doesn't even accept the input.
The shapes in the geometry column will be in some coordinate system, which should presumably be specified. I don't know whether that's the issue here, but just pointing that out...
Thanks, specifying the crs=
kwarg didn't help, but then again the error being thrown is a KeyError
about Longitude
missing.
It appears that the polygons are not being properly converted to individual points by either Holoviews are Geoviews. I can create datasets in either but when I do .to.table() there is missing data which increases each time I sort the table by clicking.
import geoviews as gv
import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
import holoviews as hv
hv.extension('bokeh')
print(gv.__version__)
print(hv.__version__)
print(gpd.__version__)
1.6.2 1.12.3 0.4.1
ds_world = hv.Dataset(world, kdims=['Longitude', 'Latitude', 'continent'], vdims='pop_est')
ds_world.to.table()
BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('Latitude', 10859), ('Longitude', 10859), ('continent', 10750), ('pop_est', 10750)
gv_dataset = gv.Dataset(world, vdims='pop_est')
gv_dataset.table()
BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('Latitude', 10859), ('Longitude', 10859), ('pop_est', 10750)
No clicks:
First click:
Second click:
Three clicks:
Bunch of clicks:
Why does this code work with
hv.Dataset
but notgv.Dataset
?