2

The CRS can be updated in a LAS object with st_crs(), but I can't for the LAS file (unless I use writeLAS()).

I have a series of LAS files output from digital aerial photogrammetry (DAP), that don't have a projection defined. I want to take another LAS file with the proper projection defined (i.e., the same as the original DAP air photos), and assign it to the DAP catalogue, and then I want to retile the DAP catalogue.

I am able to update the CRS on the DAP catalogue, but catalog_retile() doesn't use this. It does seem to use the CRS of the individual files (which I don't want).

Is there anything short of rewriting the individual DAP LAS files, to make sure the output of Retile has the CRS I want?

# ----------------------------------------------------------
# Assign a projection definition to a set of retiled LAS files
# from DIgital Aerial Photogrammetry output (lost during processing)
# ----------------------------------------------------------
library(lidR)
library(sf)

# ----------------------------------------------------------
# First set up known CRS from single LAS and catalogue with
# missing CRS
# ----------------------------------------------------------
# L4 is LAS files with existing projection definition
L4 <- readLAS("D:/working/nsgi/527_5041_202001.laz")
print(st_crs(L4))

# dapCat is a catalogue of DAP LAS files with missing projection definition
dapCat <- readLAScatalog("D:/working/dapLaS")
print(st_crs(dapCat))

# test if the same
identical(st_crs(L4), st_crs(dapCat)) # This will be FALSE

# set CRS for the catalogue to be same as known projection LAS
st_crs(dapCat) <- st_crs(L4)
print(st_crs(dapCat))

# test if the same again
identical(st_crs(L4), st_crs(dapCat)) # This is TRUE
# ----------------------------------------------------------


# ----------------------------------------------------------
# Now that the DAP catalogue has the selected CRS, retile it.
# ----------------------------------------------------------
opt_chunk_buffer(dapCat) <- 0
opt_chunk_size(dapCat) <- 1000
opt_chunk_alignment(dapCat) <- c(1000, 1000)
opt_output_files(dapCat) <- "D:/working/dapLaS_retile/dapLas_{XLEFT}_{YBOTTOM}"

dapCat = catalog_retile(dapCat)

# And read a retiled LAS file to check CRS
dapLas <-readLAS("D:/working/dapLaS_retile/dapLas_555000_5046000.las")
print(st_crs(dapLas))
identical(st_crs(dapLas), st_crs(dapCat)) # This is FALSE

1 Answer 1

2

No it is not possible because catalog_retile() is a special function that is optimized to do not load the data in R. Instead it streams the input files into the output files point by points without interacting with R.

The simplest solution is to set the correct CRS to your files using las2las from LAStools before to retile.

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.