Hi,
Following Anthony's reply I am attaching two of the POI shapefiles and the code 
for creating the spatial grid. I am not being able to read the list of these 
shapefiles and then perform the points in spatial grid function. If someone can 
help, I will be very grateful.
Here is my code for creating the spatial grid -Gridtopo_LS = 
GridTopology(cellcentre.offset = c(68.162500,6.754167), cellsize = 
c(0.008333333,0.008333333), cells.dim = c(3508,3451))class 
(Gridtopo_LS)SpatialGrid_LS = SpatialGrid (Gridtopo_LS, proj4string = 
CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"))bbox 
(SpatialGrid_LS)class(SpatialGrid_LS)summary (SpatialGrid_LS)plot 
(SpatialGrid_LS,pch=3)

Thanks very much,
Tilo


--- On Mon, 17/12/12, Tilottama Ghosh <waggyma...@yahoo.com> wrote:

From: Tilottama Ghosh <waggyma...@yahoo.com>
Subject: looping through spatial points and getting counts of spatial points in 
spatial grid in R
To: r-help@r-project.org
Date: Monday, 17 December, 2012, 0:07

Hi,
I am stuck in a looping problem. It might be an easy problem for experienced R 
users but I have been unable to do it. Any kind of help or advice will be great 
appreciated.
I am creating a spatial grid and have a list of spatial points in a folder. I 
can read the spatial points separately and get a count of the points in the 
spatial grid in R. The output should be a table showing the counts of points in 
the spatial grid. However, since there are many of these spatial points, I want 
this process to be automated. Can someone help me with this? All my spatial 
points are in one folder. 
# Creating spatial points in R - reading the POI shapefiles as 
SpatialPointsDataFrame in R autopts.rg <- readOGR(".", "AutoSvc")class
 (autopts.rg)

# Getting a count of the Spatial Points in the Spatial Data Frame in.cell <- 
overlay(SpatialGrid_LS,FinInstq2) newdata <- 
data.frame(table(in.cell))View(newdata)
"SpatialGrid_LS" is the spatial grid that I had created in R. 
I guess a For loop would help, but although I tried several things, I haven't 
been successful yet.
Thanks!
Tilo

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to