cuspa.tl.assign_points#
- cuspa.tl.assign_points(
- points: Any,
- polygons: Polygons,
- *,
- predicate: Literal['contains', 'intersects'] = 'contains',
- out: Any | None = None,
- stream: int = 0,
Assign each point to one polygon.
- Parameters:
- points
Device tensor of shape
(N, 2)or flat interleaved(2N,).- polygons
cuspa.Polygons. Itsaabbsandindexfields are populated on first call and reused on subsequent calls.- predicate
"contains"(default) — strict interior; on-edge points excluded (matches GEOScontains)."intersects"— edge-inclusive.- out
Optional pre-allocated
int32device tensor of lengthN.- stream
CUDA stream handle.
0means the default stream.
- Returns:
- int32 tensor of length
N.out[i]is the polygon index containing - point
i, or-1if no polygon contains it.
- int32 tensor of length
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.