On 11/19/2011 04:03 PM, ASANTOS wrote:
Dear colleges,
I need to create a object wit the coordinates of a grid and the
values in the point sampled, using the meuse.grid example:
## regular sampling over a grid
library(sp)
data(meuse.grid)
gridded(meuse.grid) = ~x+y
image(meuse.grid[dist])
points(spsample(meuse.grid,n=1000,type=regular), pch=3, cex=.4)
but here I don't how I can find the value in the image associated with
the grid, there are any suggestion?
pts = spsample(meuse.grid,n=1000,type=regular)
over(pts, meuse.grid)[1:10,]
part.a part.b dist soil ffreq
1 0 1 0.0001 1
2 0 1 0.0001 1
3 0 1 0.00543211 1
4 0 1 0.0001 1
5 0 1 0.0001 2
6 0 1 0.0001 2
7 0 1 0.0001 1
8 0 1 0.02646451 1
9 0 1 0.05377781 1
10 0 1 0.05936101 1
dim(over(pts, meuse.grid))
[1] 10125
class(over(pts, meuse.grid))
[1] data.frame
see also http://cran.r-project.org/web/packages/sp/vignettes/over.pdf
Hth,
--
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.pebe...@wwu.de
___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo