[R-sig-Geo] overlay(SpatialPolygonsDataFrame, SpatialPointsDataFrame)

Ingo Holz Ingo.Holz at uni-hohenheim.de
Fri Dec 14 08:55:06 CET 2007


Hi,

 I have a SpatialPolygonsDataFrame (SPolyDF) and a 
SpatialPointsDataFrame(SPoiDF). The SPolyDF is a (very) large set of 
polygons (some 30.000) and the SPoiDF is actually a grid of some 60.000 
points.

 I would like to use overlay(SPolyDF, SPoiDF) to get the information of the 
Polygon in a grid, because most of the other information I use is stored / 
provided in grids.

 I have two problems:

 1) my PC doesn't have enough memory to do this in "one step".

 2) Therefore I used a loop like 

 result <- numeric(60000)
 for (i in 1:60000) {
    res <- overlay(SPolyDF[,"name"], SPoiDF[i,]
    result[i] <- as.numeric(res)
    }

 This needs a lot of time.

Is there an easier and/or faster way to get this information with R?

Thanks, Ingo




More information about the R-sig-Geo mailing list