-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
write.las writes 0 point for point data format 8 #60
Labels
Bug
A bug in the package
Comments
It seems to be an issue in the package |
Minimal reproducible example without library(rlas)
LASfile <- system.file("extdata", "example.laz", package="rlas")
las = read.las(LASfile)
head = read.lasheader(LASfile)
pdf3 = tempfile(fileext = ".las")
pdf8 = tempfile(fileext = ".las")
# Generate dataframe with random RGBI values
las$Red = as.integer(runif(nrow(las), 0, 2^16-1))
las$Green = as.integer(runif(nrow(las), 0, 2^16-1))
las$Blue = as.integer(runif(nrow(las), 0, 2^16-1))
las$NIR = as.integer(runif(nrow(las), 0, 2^16-1))
head3 = head
head3$`Point Data Format ID` = 3L
head8 = head
head8$`Point Data Format ID` = 8L
write.las(pdf3, head3, las)
#> Warning: Invalid file: the data contains a 'NIR' attribute but point data format
#> is not set to 8 or 10
write.las(pdf8, head8, las)
las3 = read.las(pdf3)
las8 = read.las(pdf8)
head(las3)
#> X Y Z gpstime Intensity ReturnNumber NumberOfReturns
#> 1: 339002.9 5248001 975.589 269347.3 82 1 1
#> 2: 339003.0 5248000 974.778 269347.3 54 1 1
#> 3: 339002.9 5248000 974.471 269347.3 27 2 2
#> 4: 339002.9 5248000 974.025 269347.3 55 2 2
#> 5: 339003.6 5248000 974.298 269347.3 117 1 1
#> 6: 339003.5 5248000 974.985 269347.3 81 1 1
#> ScanDirectionFlag EdgeOfFlightline Classification Synthetic_flag
#> 1: 1 1 1 FALSE
#> 2: 1 0 1 FALSE
#> 3: 1 0 1 FALSE
#> 4: 1 0 1 FALSE
#> 5: 0 0 1 FALSE
#> 6: 0 0 1 FALSE
#> Keypoint_flag Withheld_flag ScanAngleRank UserData PointSourceID R G B
#> 1: FALSE FALSE -21 32 17 0 0 0
#> 2: FALSE FALSE -21 32 17 0 0 0
#> 3: FALSE FALSE -21 32 17 0 0 0
#> 4: FALSE FALSE -21 32 17 0 0 0
#> 5: FALSE FALSE -21 32 17 0 0 0
#> 6: FALSE FALSE -21 32 17 0 0 0
head(las8)
#> Empty data.table (0 rows and 20 cols): X,Y,Z,gpstime,Intensity,ReturnNumber... Created on 2023-02-02 by the reprex package (v2.0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After adding R-G-B-NIR values to the cloud I can not read the cloud back. It appears like the cloud is empty although the file itself has size.
A reproducible example is this:
EDIT:
The problem relies in the
add_lasnir()
function. If only RGB values are stored, there is no problem.The text was updated successfully, but these errors were encountered: