fix: Support h3 4.5.0 #1206
Merged
Merged
Conversation
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>
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
enabled auto-merge (squash)
June 12, 2026 16:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compute default H3 viewport per resolution for h3 4.5 compatibility
Written by Claude:
Problem
h3 4.5.0's
cells_to_geo(viacells_to_h3shape) raisesH3ResMismatchErrorwhen passed cells of mixed resolutions.default_h3_viewportpasses the full cell sample in a single call, so constructing anH3HexagonLayerfrom 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_resolutionbit-mask helper, no extra h3 calls) and callcells_to_geoonce 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.lockis intentionally untouched; the dependency bump can land separately once this merges.Verification
186 passed, 1 skippeduv run --with h3==4.5.0),tests/test_h3/:34 passed🤖 Generated with Claude Code