pyufunc.find_closest_point#

pyufunc.find_closest_point(pt, pts, k_closest=1)#

Find the closest point from a list of reference points.

Parameters:
  • pt (Point) – the point to start with

  • pts (MultiPoint) – list of reference points in the format of shapely.MultiPoint

  • k_closest (int) – k closest points for each starting point. Defaults to 1.

Returns:

list of k closest points for each point

Return type:

list

Example

>>> from shapely.geometry import Point, MultiPoint
>>> pt = Point(0, 0)
>>> pts = MultiPoint([(1, 1), (2, 2), (3, 3)])
>>> find_closest_point(pt, pts)
[POINT (1 1)]
>>> find_closest_point(pt, pts, k_closest=5)
[POINT (1 1), POINT (2 2), POINT (3 3)]

Note