cuspa.tl.assign_points#

cuspa.tl.assign_points(
points: Any,
polygons: Polygons,
*,
predicate: Literal['contains', 'intersects'] = 'contains',
out: Any | None = None,
stream: int = 0,
) → Any#

Assign each point to one polygon.

Parameters:
points

Device tensor of shape (N, 2) or flat interleaved (2N,).

polygons

cuspa.Polygons. Its aabbs and index fields are populated on first call and reused on subsequent calls.

predicate

"contains" (default) — strict interior; on-edge points excluded (matches GEOS contains). "intersects" — edge-inclusive.

out

Optional pre-allocated int32 device tensor of length N.

stream

CUDA stream handle. 0 means the default stream.

Returns:
int32 tensor of length N. out[i] is the polygon index containing
point i, or -1 if no polygon contains it.

Notes

When polygons overlap, the first containing polygon found (in index order within each grid cell) wins. Use overlap_pairs() if you need all containing polygons per point.