Re: [R] Finding the neighbors of the point

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Sat 22 Oct 2005 - 06:11:38 EST


On Fri, 21 Oct 2005, Leaf Sun wrote:

> Dear all,
>
> I got point data of trees. I was wondering if anybody has experience in searching the neighbors within a specified distance efficiently.
>
> X Y Z
> 99 34 65
> 98 35 29
> 98 34 28
> 99 33 33
> 98 32 23
> 99 33 21
> 99 33 22
> 99 32 24
> 99 30 23
> ...
>

> What I want to do is : searching for the neighbors with a distance R
> for each tree & the neighbor must have a bigger Z.
>
>
> The data set is huge so the R-codes is working slowly when I search it
> without subset it.
>

And huge is how big? For very large problems, you'll need a kd-tree or r-tree approach to divide up the point locations before making the spatial query (I think the retention of neighbours with a larger z is the final step). There do not seem to be such functions in R or contributed packages at present. If you are willing to collaborate, I can pass on a draft package corrected by Christian Sangiorgio for approximate nearest neighbours (an interface to ANN by David Mount and collaborators), but it isn't working yet. So an investment in time and some knowledge of C++ will be useful.

> Any suggestion would be much appreciated!
>
> Leaf
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand@nhh.no

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Oct 22 06:21:41 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 19:16:34 EST