visgl / visgl/deck.gl

[Bug] pydeck get_fill_color expression parser only if first element is str

Open
#6,837 0 comments 0 reactions 1 assignee View on GitHub

@ajduberstein is already working on this.

Since Apr 20, 2022.

bug pydeck
Dominant language
TypeScript
Stars
14.6k
Forks
2.3k
Avg merge
2d 9h
Merged PRs (30d)
42

Description

Description

I can use pydeck get_fill_color expression parser only if the first element is str type.
get_fill_color=["lng > 0 ? 255 : 88", "lng > 0 ? 255 : 88", "lng > 0 ? 255 : 88"], -> OK
get_fill_color=["255", "lng > 0 ? 255 : 88", "lng > 0 ? 255 : 88"], -> OK
get_fill_color=[255, "lng > 0 ? 255 : 88", "lng > 0 ? 255 : 88"], -> Not OK

Flavors
  • React
  • Python/Jupyter notebook
  • MapboxLayer
  • GoogleMapsOverlay
  • CartoLayer
  • DeckLayer/DeckRenderer for ArcGIS
Expected Behavior

get_fill_color to parse other elements when mix of str and int

Steps to Reproduce
# this works
layer = pdk.Layer(
    "ScatterplotLayer",
    UK_ACCIDENTS_DATA,
    get_position=["lng", "lat"],
    auto_highlight=True,
    get_radius=1000,
    get_fill_color=['255', "lng > 0 ? 255 : 88", "lng > 0 ? 255 : 88"],
    pickable=True,
)

# this shows all red
layer = pdk.Layer(
    "ScatterplotLayer",
    UK_ACCIDENTS_DATA,
    get_position=["lng", "lat"],
    auto_highlight=True,
    get_radius=1000,
    get_fill_color=[255, '255', '255'],
    pickable=True,
)

Environment
  • Framework version: 0.7.1
  • Browser: Chrome
  • OS: Win10
Logs

no messages

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.