Closed wiesehahn closed 10 months ago
Can you produce a minimal reproducible example with data. The following MRE works for me.
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las1 = readLAS(LASfile)
las2 = readLAS(LASfile)
st_crs(las1) <- 25832
st_crs(las2) <- 25832
st_crs(las1) == st_crs(las2)
rbind(las1,las2)
Yes sure, I created leightweight thinned versions of the files.
las1 <- readLAS(here::here("las1.laz"))
las2 <- readLAS(here::here("las2.laz"))
st_crs(las1) <- 25832
st_crs(las2) <- 25832
st_crs(las1) == st_crs(las2)
las3 = rbind(las1, las2, fill=T)
Ho, I got it! fill
is not a LAS
object. You are trying to use the data.table
version of rbind
but you are trying to bind LAS
objects, not data.table
. By the way, your point clouds are not bindable, They have a different number of attributes. The first one is format 1, the second one is format 8 (with Overlap flag, RGB, NIR and 2 extrabytes attributes)
ah Ok thanks, I tried it with the same attributes before but it didnt work for some reason.
data.table
's warning confused me as it mentioned to use fill=TRUE and after implementing that the warning was gone and the above mentioned error occured, why I thought it had worked on LAS files to fill the missing columns.
> las3 = rbind(las1, las2)
Error in data.table::rbindlist(lapply(dots, function(x) { :
Item 2 has 25 columns, inconsistent with item 1 which has 16 columns. To fill missing columns use fill=TRUE.
In addition: Warning message:
Different LAS objects have different scales and/or offsets. The first object was used as reference to quantize the others.
> las3 = rbind(las1, las2, fill=T)
Error: Different CRS.
So filtering the data in advance does the trick, e.g.:
las1 <- readLAS(here::here("las1.laz"), select = "xyzi")
las2 <- readLAS(here::here("las2.laz"), select = "xyzi")
st_crs(las1) <- 25832
st_crs(las2) <- 25832
las3 = rbind(las1, las2)
I see. I could add an error upstream to prevent data.table
to throw a confusing message.
I try to merge two pointclouds of the same extent but run into problems related to the projection.
LAS1 has no CRS stored internally and is of class LAS (v1.2 format 1).
LAS2 has a CRS stored and is of class LAS (v1.4 format 8).
Theoretically I think they should be in the same CRS. So I try to assign the CRS of LAS2 to LAS1 which gives a warning that the header was not updated but otherwise seems to work at the first glance.
When I try to merge the pointclouds now I receive an error that the CRS are different
Another option I tried is to set the crs manually for both files which has the same outcome
Yet another option I tried is to set the CRS of LAS1 manually and then transform to the CRS of LAS2 with the same outcome
And vice versa which gives no warning but otherwise the same outcome
Do you have a clue what is the problem? I guess this might be related to the fact that the files are in different LAS standards, since the documentation states that