[R-sig-Geo] overlay(SpatialPolygonsDataFrame, SpatialPointsDataFrame)
Roger Bivand
Roger.Bivand at nhh.no
Fri Dec 14 16:20:51 CET 2007
On Fri, 14 Dec 2007, Ingo Holz wrote:
> 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:
This is very similar to the thread beginning here:
https://stat.ethz.ch/pipermail/r-sig-geo/2007-December/002929.html
started yesterday. The issue is the number of polygons, because each
polygon is passed the full set of points. The short cut suggested in that
thread was to find out which polygon bounding boxes the points fell
inside, and then check that much smaller set. This is not in the current
code in sp, but contributions are welcome.
Roger
>
> 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
>
> _______________________________________________
> 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