An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20151008/d64fa65f/attachment.html>
Receiving ID of polygons when intersecting SpatialPolygons(DataFrame) and SpatialPoints
3 messages · Vv, Roman Luštrik, Edzer Pebesma
?Hello, check out the example section of `?sp`. # return the number of points in each polygon: sapply(over(sr, geometry(meuse), returnList = TRUE), length) r1 r2 r3 r4 50 57 48 0 where names in the result should be sufficiently informative. sapply(slot(sr, "polygons"), slot, name = "ID") [1] "r1" "r2" "r3" "r4" ? Cheers, Roman
On Thu, Oct 8, 2015 at 9:14 AM, Vv <venek at gmx.at> wrote:
Hi list, I am currently tackling with the sp function over. I intersect a SpatialPoints object with a SpatialPolygonsDataFrame. I'd like to know how I can receive the ID of the polygons within the Polygons slot of the SpatialPolygonsDataFrame which are intersecting the SpatialPoints? Overlap<-sp::over(spPoints, spPolyDataFrame, returnList=TRUE) Whenever I use over I just receive "1" as result. Or is there a way to intersect SpatialPoints with objects of class polygons that I miss? Best, Ena
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
In God we trust, all others bring data. [[alternative HTML version deleted]]
On 08/10/15 03:14, Vv wrote:
Hi list, I am currently tackling with the sp function over. I intersect a SpatialPoints object with a SpatialPolygonsDataFrame. I'd like to know how I can receive the ID of the polygons within the Polygons slot of the SpatialPolygonsDataFrame which are intersecting the SpatialPoints? Overlap<-sp::over(spPoints, spPolyDataFrame, returnList=TRUE) Whenever I use over I just receive "1" as result. Or is there a way to intersect SpatialPoints with objects of class polygons that I miss?
rgeos::gIntersects : with arguments byid=TRUE and returnDense=FALSE it should return a similar list.
Best, Ena
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Edzer Pebesma Institute for Geoinformatics (ifgi), University of M?nster, Heisenbergstra?e 2, 48149 M?nster, Germany; +49 251 83 33081 Journal of Statistical Software: http://www.jstatsoft.org/ Computers & Geosciences: http://elsevier.com/locate/cageo/ Spatial Statistics Society http://www.spatialstatistics.info -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: OpenPGP digital signature URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20151008/92389f45/attachment.bin>