Find intersecting units
Find which of the units in a spatial data object intersect with the units in another spatial data object.
intersecting_units(x, y) ## S4 method for signature 'Raster,Raster' intersecting_units(x, y) ## S4 method for signature 'Spatial,Spatial' intersecting_units(x, y) ## S4 method for signature 'sf,Spatial' intersecting_units(x, y) ## S4 method for signature 'Spatial,Raster' intersecting_units(x, y) ## S4 method for signature 'Spatial,sf' intersecting_units(x, y) ## S4 method for signature 'Raster,Spatial' intersecting_units(x, y) ## S4 method for signature 'sf,sf' intersecting_units(x, y) ## S4 method for signature 'Raster,sf' intersecting_units(x, y) ## S4 method for signature 'sf,Raster' intersecting_units(x, y) ## S4 method for signature 'data.frame,ANY' intersecting_units(x, y)
integer
indices of the units in x
that intersect with
y
.
# create data r <- raster(matrix(1:9, byrow = TRUE, ncol=3)) r_with_holes <- r r_with_holes[c(1, 5, 9)] <- NA ply <- rasterToPolygons(r) ply_with_holes <- st_as_sf(rasterToPolygons(r_with_holes)) # intersect raster with raster ## Not run: par(mfrow = c(1, 2)) plot(r, main = "x=Raster") plot(r_with_holes, main = "y=Raster") ## End(Not run) print(intersecting_units(r, r_with_holes)) # intersect raster with polygons (sf) ## Not run: par(mfrow = c(1, 2)) plot(r, main = "x=Raster") plot(ply_with_holes, main = "y=sf", key.pos = NULL, reset = FALSE) ## End(Not run) print(intersecting_units(r, ply_with_holes)) # intersect polygons (Spatial) with raster ## Not run: par(mfrow = c(1, 2)) plot(ply, main = "x=Spatial") plot(r_with_holes, main = "y=Raster") ## End(Not run) print(intersecting_units(ply, r_with_holes)) # intersect polygons (Spatial) with polygons (sf) ## Not run: par(mfrow = c(1, 2)) plot(ply, main = "x=Spatial") plot(ply_with_holes, main = "y=sf", key.pos = NULL, reset = FALSE) ## End(Not run) print(intersecting_units(ply, ply_with_holes))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.