# libpysal.cg.fast_knn

libpysal.cg.fast_knn(pts, k, return_dist=False, radius=6371.0)

  Computes \(k\) nearest neighbors on a sphere.

  Parameters:
    pts `python:list`

      A list of \(x,y\) pairs.

    k `python:int`

      The number of points to query.

    return_dist bool

      Return distances in the `wd` container object (`True`). Default is `False`.

    radius `python:float`

      The radius of a sphere. Default is Earth’s radius in kilometers, `RADIUS_EARTH_KM` (`6371.0`). Earth’s radius in miles, `RADIUS_EARTH_MILES` (`3958.76`) is also an option. Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html

  Returns:
    wn `python:dict`

      A neighbor ID lookup.

    wd `python:dict`

      A neighbor distance lookup (optional).