[R-sig-Geo] Reassigning coordinates?

Roger Bivand Roger.Bivand at nhh.no
Tue Nov 2 11:13:36 CET 2010


On Tue, 2 Nov 2010, Brian Oney wrote:

> Hello List,
> I need to reassign coordinates of a few points to have coordinates of the 
> nearest raster cell. I KNOW that this is BAD practice but for the time being 
> I  assume that it does not affect my analysis (species distribution 
> analysis). I think the datum of the point data is different than that of my 
> raster data, but for now it is not important.
>
> I have already perused the "sp" and "raster" packages extensively.
> I guess I just need to be pointed in the right (WRONG) direction. I had a few 
> thoughts with the distance function but I am now stuck. Maybe use "distance" 
> then "which.min" then take the coordinates?

Maybe try nn2() in the RANN package with k=1 to find the nearest neighbour 
for each query point, with - I think - grid as data and points to move as 
query?

Roger

>
> Best Regards,
> Brian
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
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 at nhh.no



More information about the R-sig-Geo mailing list