r - extracting ids of SpatialPointsDataFrame inside region of SpatialPolygons -
many pardons if has been asked before.
i have 2 r objects:
1) hex_grid spatialpointsdataframe 806 hexagonal polygons (cylindrical mercator coordinates each polygon).
2) have 18 spatialpolygons (each named cylutm), in same coordinate system.
i want determine ids of hex_grid fall of 18 spatialpolygons (named cylutm). have ids of hex_grid as...
#-------------------------------------------------< library list library( raster ) library( sp ) library( grid ) library( maptools ) library( geosphere ) #------------------------------------------------- ids = sapply(hex_grid@polygons, function(x) x@id) cylutm_boundary = which(!is.na(over(hex_grid,cylutm)))
each of 18 spatialpolygons shall contain list of ids hex_grid s.t. no 2 spatialpolygons contain list of ids intersect. using on function gives me boundary indices of cylutm polygon. there function 'inside' equivalent 'over'? efficient way solve problem?
Comments
Post a Comment