pydeck: PathLayer fails when input data contains a 0-length line
See original GitHub issueDescription
When trying to create a path layer, if the dataframe contain a path location of x->y, where x and y have the same location, instead of “ignoring” that specific path, the entire layer is corrupted. It will cause the paths in the layer to act as one path.
Repro Steps
In order to reproduce, i just used the example of the path layer, and change the path location of one item:
import pydeck
import pandas as pd
DATA_URL = "https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/bart-lines.json"
df = pd.read_json(DATA_URL)
def hex_to_rgb(h):
h = h.lstrip("#")
return tuple(int(h[i : i + 2], 16) for i in (0, 2, 4))
df["color"] = df["color"].apply(hex_to_rgb)
**df['path'][0] = [[0, 1], [0, 1]]**
view_state = pydeck.ViewState(latitude=37.782556, longitude=-122.3484867, zoom=10)
layer = pydeck.Layer(
type="PathLayer",
data=df,
pickable=True,
get_color="color",
width_scale=20,
width_min_pixels=2,
get_path="path",
get_width=5,
)
r = pydeck.Deck(layers=[layer], initial_view_state=view_state, tooltip={"text": "{name}"})
r.to_html("path_layer.html",open_browser=True, notebook_display=False)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
PathLayer — pydeck 0.8.0b4 documentation - Read the Docs
import pandas as pd import pydeck as pdk DATA_URL = "https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/bart-lines.json" df ...
Read more >Layer Overview and Examples — pydeck 0.6.1 documentation
Layer represents a kind of data visualization, like a scatterplot or a hexbin chart. The full deck.gl layer catalog is accessible via pydeck....
Read more >Error importing nebula.gl into custom PyDeck deck.gl layer
I'm trying to import nebula.gl in order to make a selection layer for PyDeck (working on reproducint this code sandbox example).
Read more >st.pydeck_chart - Streamlit Docs
Draw a chart using the PyDeck library. This supports 3D maps, point clouds, and more! More info about PyDeck at https://deckgl.readthedocs.io/en/latest/.
Read more >Andrew Duberstein -Pydeck: High-scale geospatial ... - YouTube
Brief SummaryWith social graphs, genomics, and sensor data visualizations, data scientists often need to render massive spatial data sets.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in
deck.gl@8.2.3
.Fixed in pydeck 0.4–thank you @Pessimistress!
Both examples for the code above.
pydeck 0.3.1 (locked to deck.gl 8.1)
pydeck 0.4.0 (locked to deck.gl 8.2)