Dear all,

I am working with a Lidar dataset, which contains thousands of
undistributed points. What I want to do is to count the number of points
within a raster cell and extract this information. Not just as single
numbers, but together with the ID or the coordinates of the raster. I came
to this so far:

- Create an empty raster, all cells are 0

empty.r <- raster(nrows=733, ncols=732, xmn=-158, xmx=-121, ymn=-28.3,
ymx=8.35, crs=NA)
empty.r[] <- 0

- read in the dataset of points containing only xy information and define
these as spatialpoints

r1_points <- read.table("09_16_B.txt", sep="\t", dec=".", header=F)
p <- r1_points[,-3]
 p<-SpatialPoints(data.frame(p))

- create an overlay of the raster and the spatial points and use function
table to

o <- overlay(as(empty.r, "SpatialGrid"),p)
tab <- table(o)

tab gives me the numbers of points within one cell, but I don't know how to
get this information together with the ID or XY coordinates as one table or
else. Can anyone help?

Thank you very much in advance!

Leni

	[[alternative HTML version deleted]]

