[R-sig-Geo] remove nearby points

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Feb 22 14:29:23 CET 2013


sp::zerodist might be your friend, look into the "zero" argument to 
control what is to be considered nearby.

On 02/22/2013 02:18 PM, Tim Howard wrote:
> Julian,
> Thanks for the reply. That seems like an interesting approach. I
> suppose another 'GIS' way would be to buffer all the points 100m and
> then find those where the buffers overlap. My dataset isn't too big
> (1000's records), and what I came up with seems to do the trick, so I'll
> stick with it for now.
>
> For the archives, I was a bit hasty in the solution I pasted below - it
> caught the second of the pairs, where I wanted the first of the pairs
> (after sorting descending by date). These are the lines that do it
> correctly.
>
> b <- a[0,]
> for(i in 1:nrow(a)){
>      if(is.na(a[match(a$neigh[i],rownames(a)[1:i]),]$ID)){
>          b <- rbind(b,a[i,])
>      }
> }
>
> Best to all,
> Tim
>
>
>>>> Julian Burgos <julian at hafro.is> 2/21/2013 3:24 AM >>>
> Hi Tim,
>
> Perhaps you should use clustering to identify groups of points that are
> separated 100m or more from other points.  You could:
> a) Calculate distances among points
> b) Do some type of hierarchical clustering (e.g. the function agnes in
> the cluster package).
> c) Identify as clusters everything with a dissimilarity less than
> 100m.
> d) Randomly select a single point from each cluster.
>
> Julian
>

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list