-
Notifications
You must be signed in to change notification settings - Fork 118
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
Reclassification of a COPC file #277
Comments
COPC is both
You will need to strip off the COPC VLR, write a new LAS file, and then use PDAL or Untwine or something to convert that back to COPC. There's no clean in-place editing software that speaks COPC as far as I know. |
Ahhh, thanks @hobu, I wasn't aware of that 👍 |
I guess I'll leave it open just for @tmontaigu to take a look. Maybe we could plan COPC in-place editing for laspy. |
It would be tough to do correctly. The problem is any change to any attribute of a point has the potential to ultimately change the compressed size of the chunk that point belongs to. That means updating the chunk, the chunk table, and the COPC vlr that points into both of those. For editing, it is much better to use an uncompressed data structure you can simply mmap onto disk. Then make all of your edits as you need, and then roll it up into COPC or EPT or LAS whatever after you know you're done. |
As hobu said, in place editing is tough to do correctly and would propably end up less efficient than some could expect Imagine you do a query on a COPC, you change some values (other than x,y,z) and want to write them back, now the points have to be matched back to the original file (not so hard) However, the writer will have to rewrite the chunks in which the modified points belongs, the compressed LAZ chunk size in bytes is likely not going to be the same it was originally. Worst case scenario is that one (or more) of your modified points were in the first chunk and they make the new compressed size bigger -> all chunks in the file will need to be moved. For unmodified chunk they can be moved by readin byte then redumping them (ie no need to decompress+recompress) its still So while its theorically not impossible to achieve, the 'update' is still a certain amount of work (certainly more work than one could think, if he does not know/forgets that COPC is 'just' a LAZ). |
We currently have a process that classifies points and we're using laspy to read the unclassified input and write the classified output. However, if the input has the COPC vlr an exception is raised when trying to write the output because laspy doesn't support COPC writing as of now.
I was wondering if there would be a laspy workaround in this case or if we'll have to read the header bytes and write the output bytes without using the library. As we're not touching the file geometry or the pointformat, the COPC blob should still be valid.
The text was updated successfully, but these errors were encountered: