developmentseed / developmentseed/lonboard

[BUG] H3 layers are not fully rendered in Map when layer is swapped

Open
#1,044 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
964
Forks
54
Avg merge
5m
Merged PRs (30d)
1

Description

## Context

When i use `ScatterPlotLayer`s in my `Map`, i can dynamically replace the layers and the map redraws as expected.

https://github.com/user-attachments/assets/70122b1a-41e9-483c-970c-43d691c80440

However, when I use `H3HexagonLayer` and try to do the same thing, the map never fully redraws until i pan or zoom the map. The outlines of the hexagons are being drawn.

https://github.com/user-attachments/assets/51e6c247-2983-43f7-9aa9-1ccb9baefb2d

## Resulting behaviour, error message or logs

No logs/warnings/errors.

## Environment

- OS: Mac Sequoia 15.6.1
- Browser: VSCode/Cursor using `IPython.display`
- Python 3.13.5
- Lonboard Version: [e.g. 0.13.0]

## Steps to reproduce the bug

1. build h3 hexagon layers that i can dynamically switch between with a slider widget
2. create map and set first h3 layer (doesn't render fully until panning/zooming)
3. on slider change, dynamically replace the map's layer with pre-computed layer

For clarity, when I say "replace the map's layer" I mean:

```py
map_widget = Map(...)
slider = widgets.IntSlider(...)

def on_slider_change(change):
current_minute_idx = change["new"]
new_layer = bin_layers[current_minute_idx]
map_widget.layers = [new_layer]

slider.observe(on_slider_change, names="value")
```

I'm creating the layers as follows

```py
bin_layers = {}
for ... in range(...):
colors = ...

# Create H3 layer
layer = H3HexagonLayer(layer_table, get_hexagon=layer_table.column("h3_index"))
layer.get_fill_color = colors
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.