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

Compatibility between spatialpandas.dask.DaskGeoDataFrame and HoloViews, GeoViews and hvplot? #53

Open
julioasotodv opened this issue Jan 20, 2021 · 3 comments

Comments

@julioasotodv
Copy link

Hi,

Apparently, there is no support for spatialpandas.dask.DaskGeoDataFrames in HoloViz plotting libraries other than datashader.

A simple example:

import holoviews as hv
hv.extension("bokeh")

# I have a single-row Parquet file I created using spatialpandas. 
# It only contains one row and one column, called geometry, which contains a MultiLine object. 
# I can easily read in as a spatialpandas.dask.DaskGeoDataFrame:
from spatialpandas.io import read_parquet_dask

df = read_parquet_dask("sample_spatialpandas_row.parquet")

# I now want to plot the multiline. For instance, with hvplot:
import hvplot.dask

df.hvplot()

# This raises an exception: Supplied data type DaskGeoDataFrame not understood

# And the same goes for instance for GeoViews:
import geoviews as gv

gv.Path(df)

# It does not recognizes it as a geodataframe-like element, raising: 
# ValueError: kdims: list length must be between 2 and 2 (inclusive)

The above is just an example, obviously. You can find the sample parquet file I used here (needs to be unzipped).

Having this working would allow datashading dinamically and directly from Holo/GeoViews/HvPlot using holoviews.operation.datashader on larger than memory datasets, backed by spatialpandas.dask.DaskGeoDataFrame, which would be amazing.

What do you think?

@jbednar
Copy link
Member

jbednar commented Jan 20, 2021

Thanks for dropping in at the right time! You can try out the just-added DaskGeoDataFrame support in HoloViews using something like:

git clone [email protected]:holoviz/holoviews.git
cd holoviews
git checkout dask_spatialpandas
pip install --no-deps -e .

and then re-running your code. I haven't tested your code with this work-in-progress branch, so I don't know if it will work yet, but you can see what we are testing it with at holoviz-topics/examples#130 .

@julioasotodv
Copy link
Author

Thanks @jbednar for reaching out!

Sure, I will try it this afternoon and will provide feeback :)

@julioasotodv
Copy link
Author

julioasotodv commented Jan 20, 2021

Ok so I just tried with the branch dask_spatialpandas in HoloViews, and now it seems to be at least accepted. The following line:

plot = gv.Path(df)

Does not raise an exception anymore; but the plot is not generated. If I just write in a single-line cell in Jupyter:

plot

It only outputs what I think it is the hv.Dataset info:

:Path   [Longitude,Latitude]

But the chart is not generated.

Also, for hvplot the ValueError still remains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants