I used the following commands as mentioned in the answer here
ctg = readLAScatalog(...)
p = read.table(...)
opt_output_file <- "/folder/AOI_{Id_placett}"
aois = lasclipCircle(ctg, p$x, p$y, 10)
The opt_output_file <- "/folder/AOI_{Id_placett}"
command only created a variable named 'opt_output_file'. Apparently, this variable was not used in the following clipping command and the results was a lascatalog named 'aois' only. No files were written.
I then used the ABA approach. Here it seems to have been used differently, as follows:
ctg <- readLAScatalog(...)
plots <- st_read("...")
opt_output_files(ctg) <- paste0(tempdir(), "/{Id_placett}") #Id_placett is the column name
plots_ALS_clipped <- lasclip(ctg, plots, radius=15)
The lascatalog i.e. ctg is mentioned in the command opt_output_files(ctg)
. This seems to have worked and a temporary folder was created. But there are two issues that I encountered:
1) If I replace tempdir()
with another path, I don't see any files in the location specified by me. There are some files (not all clipped plots) in the RtmpSQSLrf folder shown below. In the ABA example, it was mentioned that the clipped plots will be saved on the HDD
2) {/Id_placette} is used as a column name to retain the names of the clipping polygons. But all the clipped las entities in the lascatalog end with the column name i.e. "Id_placett". I thought they are supposed to end with corresponding clipping polygon names.
For example, plots_ALS_clipped@data$filename
returns the following (showing only first few entries):
[1] "\\AppData\\Local\\Temp\\RtmpSQSLrf\\Id_placett.las"
[2] "\\AppData\\Local\\Temp\\RtmpSQSLrf\\Id_placett.las"
[3] "\\AppData\\Local\\Temp\\RtmpSQSLrf\\Id_placett.las"
[4] "\\AppData\\Local\\Temp\\RtmpSQSLrf\\Id_placett.las"
[5] "\\AppData\\Local\\Temp\\RtmpSQSLrf\\Id_placett.las"
As you can see, all the clipped areas in the plots_ALS_clipped are named as 'Id_placett'
p
is adata.frame
or not. Ifplots
is aSpatialPointsDataFrame
of not. You didn't tell us the names of your columns neither inp
nor inplots
. Tell us more about your objects.