query

SearchTree.query(x, k=1, d=None, pick_relative_to_closest=True)

Find the (k) closest points.

Parameters:
  • x (list, tuple or np.array of length 2) – The x- and y- coordinates to search.

  • k (int, optional) – The number of points to identify. The default is 1.

  • d (float, optional) – The max. distance (in plot-crs) to consider when identifying points. If None, the currently assigned distance (e.g. m.tree.d) is used. (see m.tree.set_search_radius on how to set the default distance!) The default is None.

  • pick_relative_to_closest (bool, optional) –

    ONLY relevant if k > 1.

    • If True: pick (k) nearest neighbours based on the center of the closest point

    • If False: pick (k) nearest neighbours based on the click-position

    The default is True.

Returns:

i – The indexes of the selected datapoints with respect to the flattened array.

Return type:

list