Naming outputs by X and Y coordinates #97
Replies: 2 comments 1 reply
-
No it is not possible sorry. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey, # function to get extent and center coordinate for a bunch of files
get_center <- function(path, full.names = FALSE){
get_file_center <- function(file){
fileheader <- lidR::readLASheader(file)
minx = fileheader$`Min X`
miny = fileheader$`Min Y`
maxx = fileheader$`Max X`
maxy = fileheader$`Max Y`
meanx = as.integer(minx + 0.5*(maxx-minx))
meany = as.integer(miny + 0.5*(maxy-miny))
if (full.names == FALSE){
file <- basename(file)
}
return(data.frame(file = file, minx, miny, maxx, maxy, meanx, meany))
}
f <- list.files(path, pattern = "*.laz$", full.names = TRUE)
return(as.data.frame(do.call(rbind, lapply(f, get_file_center))))
}
# apply function on folder and rename laz files to xcenter_ycenter.laz
t <- get_center(yourfolder, full.names = T)
file.rename(from = t$file, to = fs::path(dirname(t$file), paste0(t$meanx, "_", t$meany, ".laz"))) This does not directly save the output with your desired name, but it renames files afterwards. To do this we will not read the entire files but just their headers, which might not be super correct but much quicker. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello. Is it possible to write lasR outputs named according to their X and Y center coordinates, as it was in lidR? I can't find this in the documentation, sorry if I missed it.
I am essentially retiling flight lines in the classification step, and would like them to be named as follows:
pipeline = reader_las() + classify_with_ivf() + classify_with_csf() + write_las(paste0(root_dir, "/output/_1_classified_points/{XCENTER}_{YCENTER}_ground.las"))
Beta Was this translation helpful? Give feedback.
All reactions