nearest_neighbor#

RTree.nearest_neighbor(rtree_obj)#

Find the nearest neighbor of a given RTree object.

Parameters:
rtree_objRTreeObj

R-tree object with index in this form: (polygon, id pair).

Returns:
tuple of RTreeObj, tuple[PointData, PointData]
  • RTreeObj: Nearest-neighbor in the RTree to the provided object, or null if nothing is found.
  • tuple[PointData, PointData]: Line segment spanning the closest points between the object

    and the nearest neighbor.