question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pydeck: PathLayer fails when input data contains a 0-length line

See original GitHub issue

Description

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:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Pessimistresscommented, Jul 17, 2020

Fixed in deck.gl@8.2.3.

0reactions
ajdubersteincommented, Jul 24, 2020

Fixed in pydeck 0.4–thank you @Pessimistress!

Both examples for the code above.

pydeck 0.3.1 (locked to deck.gl 8.1)

image

pydeck 0.4.0 (locked to deck.gl 8.2)

image

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found