geohierarchy.gpu_spatial¶
Point-in-polygon pairs on the GPU (CuPy), with the CPU (shapely) as the fallback.
point_polygon_pairs(x, y, polygons) -> (point_index, polygon_index) for every polygon that contains the point (strictly inside; the boundary is a measure-zero case)
The candidates come from a shapely STRtree bounding-box query (C, fast); the exact test is an even-odd crossing count over all rings of the polygon (shell and holes), run one
(point, polygon) pair per GPU thread when a CUDA device is usable and the job is large (see _backend), otherwise shapely.contains_xy on the CPU. Same result either way.
point_polygon_pairs(x, y, polygons, force=None)
¶
(point_index, polygon_index) arrays of every (point, polygon) with the point inside the polygon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Point x coordinates (longitude or projected x). |
required |
y
|
ndarray
|
Point y coordinates, same CRS as |
required |
polygons
|
Polygon geometries (shapely), same CRS as the points. |
required | |
force
|
str | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
|
Two integer arrays |