libpysal.cg.brute_knn¶
- libpysal.cg.brute_knn(pts, k, mode='arc', radius=6371.0)[source]¶
Computes a brute-force \(k\) nearest neighbors.
- Parameters:
- pts
python:list A list of \(x,y\) pairs.
- k
python:int The number of points to query.
- mode
python:str The mode of distance. Valid modes are
'arc'and'xyz'. Default is'arc'.- 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
- pts
- Returns:
- w
python:dict A neighbor ID lookup.
- w