0

I'm trying to modify/update the code in this answer (Partially processing a catalog with an extent in lidR), in order to partially process a catalog with a polygon (e.g., to pick up after a computer crash):

library(lidR)

ctg <- readLAScatalog("D:/Project2024_0507")

aoi <- read_sf(dsn = "D:/Project2024_0507",
               layer = "toDo_May16",
               quiet = TRUE,
               stringsAsFactors = FALSE,
               as_tibble = TRUE)
aoisp <- sf::as_Spatial(aoi)

spctg <- as.spatial(ctg)
ctg$processed <- T
ctg$processed <- sf::st_intersection(aoisp, spctg)

Both aoisp and spctg are class SpatialPolygonsDataFrame. But st_intersection gives me an error (no applicable method).

Additionally, st_intersection doesn't allow for extracting the id necessary for $processed.

1 Answer 1

1

Try

catalog_intersect(ctg, aoi, subset = "flag_processed")

Or the opposite depending on your need

catalog_intersect(ctg, aoi, subset = "flag_unprocessed")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.