pyinterp.RTree3DFloat32.query#
- RTree3DFloat32.query(self, coordinates: numpy.ndarray[dtype=float32, shape=(*, *), writable=False], config: pyinterp.core.config.rtree.Query | None = None) tuple[numpy.ndarray[dtype=float64, shape=(*, *), order='F'], numpy.ndarray[dtype=float32, shape=(*, *), order='F']]#
Query k-nearest neighbors for multiple points.
Find the k-nearest neighbors for each query point.
- Parameters:
coordinates – Query coordinates, shape (n, 3) or (n, 2). Must use the same coordinate system as the points in the tree.
k – Number of neighbors to find.
boundary_check – Type of boundary verification: ‘none’ (default), ‘envelope’ (AABB), or ‘convex_hull’.
num_threads – Number of threads for parallel computation. 0 = auto.
- Returns:
Tuple of (distances, values) matrices of shape [n_points x k].
distances: Distance from each query point to its k-nearest neighbors. When no spheroid is provided, distances are in the same units as the Cartesian coordinates.
values: Values at those k-nearest neighbors
Note
Distance calculations depend on the coordinate system. With a spheroid, distances are geodetic; without one, distances are Euclidean in the provided Cartesian coordinate system.