Skip to content

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:

            

  
    
#
On 08/10/15 03:14, Vv wrote:
rgeos::gIntersects : with arguments byid=TRUE and returnDense=FALSE it
should return a similar list.