Skip to content

H3HexagonLayer in pydeck doesn't display #1229

@mysterefrank

Description

@mysterefrank

I previously posted this as a feature request but realized it's a bug.
Data loaded in an H3HexagonLayer in pydeck doesn't display. The data I'm hoping to visualize has lat long and hex features. Loading the lat longs into a HexagonLayer works, loading the hex feature into an H3HexagonLayer does not. There's no error message - the map displays with no data overlay. I ran the same code in a notebook without streamlit and it works as expected, so this isn't a pydeck bug.

Here's the relevant code:

st.write(
  pdk.Deck(
    mapbox_key='my_key',
    map_style="mapbox://styles/mapbox/light-v9",
    tooltip={"text": "Trips: {count}"},
    initial_view_state=pdk.ViewState(
      latitude=40.763781,
      longitude=-111.894560,
      zoom=10,
      bearing=0,
      pitch=50
    ),
    layers=[
      pdk.Layer(
        "H3HexagonLayer",
        df,
        pickable=True,
        stroked=True,
        filled=True,
        extruded=True,
        get_hexagon="hex",
        get_fill_color=f"[255, (1 - count / {max_count}) * 255, 0]",
        get_elevation='count * 20',
        get_line_color=[255, 255, 255],
        line_width_min_pixels=2,
      ),
    ],
  )
)

Here's df.head():

  hex start_hour count
8926960292fffff 0 1
8926960440bffff 0 1
8926960444bffff 0 1
89269604457ffff 0 1
892696044cfffff 0 1

Metadata

Metadata

Assignees

Labels

feature:chartsRelated to charting functionalitytype:bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions