Describe the bug
The CUDA polygon scanline kernel has a hard cap of 2048 active edges per row and silently truncates beyond that, producing wrong output.
# xrspatial/rasterize.py:1178
MAX_ISECT = 2048
if count > MAX_ISECT:
count = MAX_ISECT
The eager CuPy path emits a RuntimeWarning at line 1389 when the cap is exceeded but still returns the corrupted raster. The Dask+CuPy tile path at line 1779 does not appear to perform the same warning check before launching per-tile kernels, so per-tile truncation can be silent.
Expected behavior
Either fail fast with a clear error, or fall back to the CPU scanline path. Returning a known-wrong raster (with a warning the caller may not see) is not safe for downstream pipelines.
Suggested fix
Raise a ValueError in the eager CuPy path when the cap is exceeded. Apply the same check in the Dask+CuPy tile loop. If a fallback to CPU is preferred over a hard error, document it and route through the CPU implementation.
Files: xrspatial/rasterize.py:1178, 1389, 1779
Describe the bug
The CUDA polygon scanline kernel has a hard cap of 2048 active edges per row and silently truncates beyond that, producing wrong output.
The eager CuPy path emits a
RuntimeWarningat line 1389 when the cap is exceeded but still returns the corrupted raster. The Dask+CuPy tile path at line 1779 does not appear to perform the same warning check before launching per-tile kernels, so per-tile truncation can be silent.Expected behavior
Either fail fast with a clear error, or fall back to the CPU scanline path. Returning a known-wrong raster (with a warning the caller may not see) is not safe for downstream pipelines.
Suggested fix
Raise a
ValueErrorin the eager CuPy path when the cap is exceeded. Apply the same check in the Dask+CuPy tile loop. If a fallback to CPU is preferred over a hard error, document it and route through the CPU implementation.Files:
xrspatial/rasterize.py:1178,1389,1779