Skip to content

(no subject)

8 messages · x wong, Jonathan Greenberg, Rick Reeves +1 more

#
It seems that a raster-based approach would make more sense, rather than 
the hugely computationally inefficient approach you are suggesting -- 
how about using a least cost path or euclidean distance approach?  Both 
are available in many GIS packages (ArcMap, GRASS GIS, etc...)

--j
x wong wrote:
#
Assuming that this dataset fits within the confines of R, this could be 
done with sp package:  spdistsN1() function
See attached sample solution:

http://nceas.ucsb.edu/scicomp/GISSeminar/UseCases/AssignClosestPointsR/AssignClosestPointsR.html

Hope this helps! RR
Jonathan Greenberg wrote:

  
    
#
On Wed, 8 Apr 2009, x wong wrote:

            
Note that this will be inefficient in that it calculates all the 
distances. I have an off-CRAN package interfacing ANN, which - given two 
sets of points, returns the k nearest in the first set (with distances) 
for each point in the second set. ANN builds a tree of the first set, so 
searches for nearest neighbours efficiently. Look for:

http://spatial.nhh.no/R/etc/ann*

The Windows binary wasn't built for the current release of R, so probably 
needs rebuilding - let me know if you use Windows, and I'll re-build it.

Hope this helps,

Roger

  
    
#
On Thu, 9 Apr 2009, x wong wrote:

            
The link works:

http://spatial.nhh.no/R/etc/ann*

means look in:

http://spatial.nhh.no/R/etc/

for all files with names beginning with ann. The build for R 2.8.* is at:

http://spatial.nhh.no/R/etc/ann_0.3-2.zip

You will have to subset your data into two matrices of planar coordinates, 
one matrix for the data= argument, the other for the query= argument to 
ann(). The output object contains the k nearest neighbours in data= for 
each point in query=, and their distances. See ?ann after installing the 
package.

Roger