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:
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:
dear all,



I have a raster GIS map converted to points. Now, I am trying to calculate the nearest neighbor distance for every point to a cluster of points within
this map. Since the number of points is more than two millions, I am
wondering whether there is a computation efficient way to do this.



The following is what the data looks like:

point_id,x_coord,y_coord,class

675,-821292,6896866,GL

738,-819294,6895866,GL

803,-819294,6894867,GL

804,-818295,6894867,GL

805,-817296,6894867,GL

806,-816297,6894867,RCK

873,-818296,6893867,GL

874,-817297,6893867,GL

875,-816298,6893868,RCK

876,-815299,6893868,RCK

877,-814300,6893868,RCK

878,-813300,6893868,GL

945,-817297,6892867,GL

946,-816298,6892868,RCK

947,-815299,6892868,RCK

948,-814300,6892868,RCK

949,-813301,6892868,GL

950,-812302,6892869,GL

951,-811303,6892869,GL

1021,-816298,6891868,RCK

1023,-814300,6891868,RCK

1024,-813301,6891869,GL

1025,-812302,6891869,GL

1027,-810304,6891869,GL

1028,-809305,6891870,GL

1029,-808306,6891870,GL

1098,-816299,6890868,RCK

1099,-815300,6890868,RCK

1100,-814301,6890868,GL

1101,-813302,6890869,GL

............................................



I want to calculate, for example, the nearest distances for all GL points to
the RCK class.





X.W.

    [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
Rick Reeves
Scientific Programmer/Analyst and Data Manager
National Center for Ecological Analysis and Synthesis
UC Santa Barbara
www.nceas.ucsb.edu
805 892 2533

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to