I am trying to visualize some LINESTRINGS in a Jupyter Notebook using the Path Object in Goeviews. The Path should be colorcoded by the amount of traffic (see example below). I read the related post Displaying Paths with Geoviews and the given example worked for me.
However, the coloring does not seem to work for Linestrings. Am I missing something? Any help is much appreciated!
import requests
import geopandas as gpd
import json
import holoviews as hv
import geoviews as gv
hv.extension('bokeh')
url = 'http://stadtplan.bonn.de/geojson?Thema=19584'
r = requests.get(url)
data = r.json()
gdf_traffic = gpd.GeoDataFrame.from_features(data['features'])
gdf_traffic.head(1)
#'geschwindigkeit' = 'traffic' in German
%%opts Path [width=500 height=500 color_index="geschwindigkeit"] (cmap='inferno')
gv.Path(gdf_traffic, vdims=["geschwindigkeit"])
Having a similar issue, I ended up using
hvplot
:You’ll need to
import hvplot.pandas
before the geodataframe is created.I’m not sure why entries are missing in the legend, didn’t look into it yet. Not sure how to change the colormap either, there seems to be related bug reports on HoloViz’s github.