Skip to content
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

Shift of Z values in writeLAS output #4

Closed
floriandeboissieu opened this issue May 23, 2017 · 2 comments
Closed

Shift of Z values in writeLAS output #4

floriandeboissieu opened this issue May 23, 2017 · 2 comments
Labels
Bug

Comments

@floriandeboissieu
Copy link
Contributor

@floriandeboissieu floriandeboissieu commented May 23, 2017

Hi Jean-Romain,
I noticed a 0.01 shift of certain Z values when writing to las/laz, there seem to be a bug there. It seems to be related with some particular Z values, see code below.
Here is how I could reproduce the bug:

LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar = readLAS(LASfile)
writeLAS(lidar,"/Megaplot.cpy.laz")
365868 bytes written
Column pulseID skipped. It does not meet las specifications.
lidar1=readLAS("
/Megaplot.cpy.laz")
any(lidar$Z-lidar1$Z>0)
[1] TRUE
(lidar$Z-lidar1$Z)[lidar$Z-lidar1$Z>0][1:10]
[1] 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01

writeLAS(lidar1,"/Megaplot.cpy.cpy.laz")
365868 bytes written
Column pulseID skipped. It does not meet las specifications.
lidar2=readLAS("
/Megaplot.cpy.cpy.laz")
any(lidar2$Z-lidar1$Z>0)
[1] FALSE

@floriandeboissieu
Copy link
Contributor Author

@floriandeboissieu floriandeboissieu commented May 23, 2017

Easier to copy paste like this maybe

LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar = readLAS(LASfile)
writeLAS(lidar,"~/Megaplot.cpy.laz")
lidar1=readLAS("~/Megaplot.cpy.laz")
any(lidar$Z-lidar1$Z>0)
(lidar$Z-lidar1$Z)[lidar$Z-lidar1$Z>0][1:10]
writeLAS(lidar1,"~/Megaplot.cpy.cpy.laz")
lidar2=readLAS("~/Megaplot.cpy.cpy.laz")
any(lidar2$Z-lidar1$Z>0)
@Jean-Romain Jean-Romain reopened this May 23, 2017
Jean-Romain added a commit that referenced this issue May 23, 2017
@Jean-Romain
Copy link
Owner

@Jean-Romain Jean-Romain commented May 23, 2017

Try that one. It's fine on my computer (devel branch). It was a problem of computer precision

@Jean-Romain Jean-Romain added the Bug label Jun 9, 2017
Jean-Romain added a commit that referenced this issue Dec 31, 2018
Jean-Romain added a commit that referenced this issue Dec 31, 2018
Former-commit-id: c7bd5bc
Jean-Romain added a commit that referenced this issue Dec 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.