Skip to content

fix: Support h3 4.5.0 #1206

Merged
kylebarron merged 2 commits into
mainfrom
h3-4.5-compat
Jun 12, 2026
Merged

fix: Support h3 4.5.0 #1206
kylebarron merged 2 commits into
mainfrom
h3-4.5-compat

Conversation

@kylebarron

@kylebarron kylebarron commented Jun 12, 2026

Copy link
Copy Markdown
Member

Compute default H3 viewport per resolution for h3 4.5 compatibility

Written by Claude:

Problem

h3 4.5.0's cells_to_geo (via cells_to_h3shape) raises H3ResMismatchError when passed cells of mixed resolutions. default_h3_viewport passes the full cell sample in a single call, so constructing an H3HexagonLayer from mixed-resolution cells crashes during default-viewport computation under h3 ≥ 4.5. (Found while attempting a lockfile upgrade; any user with mixed-resolution cells would hit this.)

Fix

Group the sampled cells by resolution (using lonboard's existing vectorized get_resolution bit-mask helper, no extra h3 calls) and call cells_to_geo once per resolution — at most 16 calls — then derive the bbox/centroid from the combined boundary coordinates. Behavior is unchanged for single-resolution inputs and works under both h3 4.4 and 4.5. This preserves the boundary-based bbox semantics; a centroid-only approach would understate the bbox for coarse cells.

Adds test_mixed_resolution_default_viewport, which builds a layer from one cell at each resolution 0–15 and asserts a real finite viewport is computed. Verified red under h3 4.5.0 before the fix (H3ResMismatchError), green under both versions after.

uv.lock is intentionally untouched; the dependency bump can land separately once this merges.

Verification

  • h3 4.4.2 (locked), full suite: 186 passed, 1 skipped
  • h3 4.5.0 (uv run --with h3==4.5.0), tests/test_h3/: 34 passed

🤖 Generated with Claude Code

h3 4.5.0's `cells_to_geo` (via `cells_to_h3shape`) raises
`H3ResMismatchError` when passed cells of mixed resolutions, so
constructing an `H3HexagonLayer` from mixed-resolution cells crashed
while computing the default viewport. Group the sampled cells by
resolution and call `cells_to_geo` once per resolution, then derive the
bbox/centroid from the combined coordinates. Behavior is unchanged for
single-resolution inputs and works under both h3 4.4 and 4.5.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ds-release-bot ds-release-bot Bot added the fix label Jun 12, 2026
@kylebarron kylebarron changed the title fix: Compute default H3 viewport per resolution for h3 4.5 compatibility fix: Support h3 4.5.0 Jun 12, 2026

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

kylebarron added a commit that referenced this pull request Jun 12, 2026
this should unblock the CI failure we currently have in #1206 , #1205 ,
#1204

Written by claude:

---

### Problem

CI fails on 13 tests with `requests.exceptions.HTTPError: 403 Client
Error: Forbidden` for
`https://www.nyc.gov/assets/planning/download/zip/data-maps/open-data/nybb_16a.zip`
— nyc.gov no longer serves the `nybb` test dataset. Local runs only pass
when a warm `geodatasets` cache exists.

### Fix

Bump `geodatasets` 2026.1.0 → 2026.5.1 in `uv.lock` (single-package
upgrade, nothing else changes). The new release relocates the `nybb`
download to
`https://github.com/geopandas/geodatasets/raw/refs/heads/main/data_backup/nybb_16a.zip`.

### Verification

With the geodatasets cache removed (simulating CI),
`tests/test_map.py::test_default_view_state_inferred` and
`tests/test_viz.py::test_viz_reproject` — both failing in CI — pass and
download from the new URL: `2 passed`.

This unblocks CI for #1205 and #1206, which should be rebased/rerun once
this merges.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@kylebarron
kylebarron enabled auto-merge (squash) June 12, 2026 16:48
@kylebarron
kylebarron merged commit 4b4d943 into main Jun 12, 2026
5 checks passed
@kylebarron
kylebarron deleted the h3-4.5-compat branch June 12, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant