[R-sig-Geo] grid and spatial selection
Robert J. Hijmans
r.hijmans at gmail.com
Sat Jul 24 05:46:08 CEST 2010
rgeos is looking very good! This can also be done with 'sp' :
o = overlay(maillesfrance, spcsv2)
i = na.omit(unique(o))
select = maillesfrance[i, ]
On Fri, Jul 23, 2010 at 8:22 PM, rundel <rundel at gmail.com> wrote:
> This should be possible with rgeos, with the caveat that it may be fairly
> slow, for the time being, if the number of points and or polygons is large.
> The package is still in development so the documentation is still a work in
> progress and there are not binaries available. If you get stuck I'd be happy
> to help troubleshoot the installation.
> You will want to use the gContains function, I have included a toy example
> below to hopefully get you started:
> gt <- GridTopology(c(0.05,0.05), c(.1,.1), c(10,10))
> grd <- SpatialGrid(gt)
> spi <- as(grd, "SpatialPixels")
> spol <- as(spi, "SpatialPolygons")
> pts = SpatialPoints(cbind(x,y))
> ct = gContains( spol,pts,byid=c(TRUE,TRUE) )
> colsub = apply(ct, 2,any)
> If you have any questions or run into any bugs let me know.
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/grid-and-spatial-selection-tp5329029p5331970.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
More information about the R-sig-Geo