[Liblas-devel] Updating header information when writing a .laz file

Peder Axensten Peder.Axensten at slu.se
Fri Oct 28 06:27:10 EDT 2011


Martin,

This sounds very interesting! The call to LASzipper::close() most probably comes later in my case. 
I use liblas::Writer for my output, how do I access the proper LASzipper instance from it?


Presently I do:
~MyWriterClass() {
	my_liblas_writer.SetHeader( my_updated_header );
	// …and then my_liblas_writer is destructed.
}


I'd like to try
~MyWriterClass() {
	if( my_liblas_writer.GetHeader().Compressed() ) {
		liblas::LASzipper	zipper = ?????;
		zipper.close();
	}
	my_liblas_writer.SetHeader( my_updated_header );
	// …and then my_liblas_writer is destructed.
}


Best regards,
/Peder



On 27 okt 2011, at 16:09, Martin Isenburg wrote:

> hi.
> 
> not sure at which point in liblas the call "LASzipper::close()" is
> happening. but if you move the stream pointer to update the LAS header
> before that call then you will corrupt the LAZ output. the
> "LASzipper::close()" flushes the remaining compressor bytes and writes
> the chunking table. so if you move the stream pointer, make sure you
> move it back.
> 
> cheers,
> 
> martin
> 
> On Thu, Oct 27, 2011 at 7:04 AM, Peder Axensten <Peder.Axensten at slu.se> wrote:
>> Maybe I've missed something, but liblas doesn't seem to update the header information when closing a file it has been writing to.
>> 
>> So I have created a class that handles this in its destructor. The problem is that although it works on uncompressed (.las) files, this corrupts compressed (.laz) files. I guess that supplying a header with the correct information already when creating the file would work, but usually the info (e.g. bounding box, number of points by return) is not available then.
>> 
>> Are there any plans to make liblas update the header information 'automagically'?
>> Is the issue with corrupt .laz files known?
>> 
>> I've tried it on 1.7.0b2 and on the latest (this morning) from git.
>> 
>> Best regards,
>> 
>> Peder Axensten
>> Research engineer
>> 
>> Swedish University of Agricultural Sciences
>> Dept. of Forest Resource Management
>> Forest Remote Sensing
>> _______________________________________________
>> Liblas-devel mailing list
>> Liblas-devel at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/liblas-devel
>> 



More information about the Liblas-devel mailing list