"Append" functionality in laszip DLL?

67 views
Skip to first unread message

Evon Silvia

unread,
Mar 6, 2018, 5:52:15 PM3/6/18
to last...@googlegroups.com
Hello,

Is there any functionality in the LASzip DLL to support adding points to an existing LAS/LAZ file? As an example use case, the need for this might arise when importing swaths and outputting tiles, and there's too many tiles to keep all of the file handles open at the same time. As far as I can tell, all of the LAS/LAZ writers use the "wb" arguments to fopen(), which deletes the existing file.

It should be pretty straightforward to append point records and update the header, at least for a LAS file, but I haven't gotten familiar enough with the actual compression to know how hard something like this might be.

Thanks!
Evon
--
Quantum Geospatial Logo
Evon Silvia PLS
QSI Solutions Developer
ASPRS LAS Working Group Chair
517 SW 2nd Street, Suite 400, Corvallis, OR 97333
P: (541) 452-8502



Martin Isenburg

unread,
Mar 6, 2018, 7:46:39 PM3/6/18
to LAStools - efficient command line tools for LIDAR processing
Hello Evon,

Such a function does not exist as a "true" append (starting from a closed LAZ file) is not trivial to implement. One would have to strip the chunk table and uncompress the last (partial) chunk and then re-compress it again to get back to the correct compressor state. In lastile I get around this by simply "stealing" the file descriptor from the compressor without closing the compressor and then only closing the file. When I need to write to that compressor again then I re-open the (incomplete) LAZ file in append mode and "sneak the re-opened file descriptor back" to the compressor who kept his state and did not even notice its file had been closed as it was not writing any pokers between the "stealing" and the "sneaking back". However ... as file descriptors cannot be passed to the DLL this "stealing" and "sneaking" and the closing and reopening would have to be exposed via new functions and then be managed inside the DLL.

Regards,

Martin

Reply all
Reply to author
Forward
0 new messages