Skip to content

fix: support raster labels above uint16#2

Closed
stanbot8 wants to merge 1 commit into
mainfrom
agent/preview-987-raster-label-dtype
Closed

fix: support raster labels above uint16#2
stanbot8 wants to merge 1 commit into
mainfrom
agent/preview-987-raster-label-dtype

Conversation

@stanbot8

@stanbot8 stanbot8 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Preview. Text in square brackets becomes links in the submission.

Two implementations exist. This one uses 1 canvas and only removes the label-count limit. The other implementation uses opt-in lazy tiles to limit output memory and includes this commit first. Compare the remaining limits.

Summary

In [issue 987], rasterize(..., return_regions_as_labels=True) rejects more than 65,535 labels. Select the output dtype from the maximum label. Closes issue 987.

Design

Use the existing _get_uint_dtype() helper, as proposed in the [maintainer direction]. Small outputs remain uint16. Larger outputs use uint32 or uint64 only when required.

The change is in [rasterize.py].

Tests

1 boundary test rasterizes 65,536 indexed points. It preserves label 65,536 in uint32 output.

The focused rasterization suites pass with 28 tests. The complete suite passes with 1,365 tests, 7 skips, and 1 expected failure. An isolated installed wheel passes the same boundary case.

The test is in [test_rasterize.py].

Commands
uv run pytest tests/core/operations/test_rasterize.py::test_rasterize_points_selects_label_dtype -q

@stanbot8 stanbot8 closed this Jul 24, 2026
@stanbot8
stanbot8 deleted the agent/preview-987-raster-label-dtype branch July 24, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant