[Liblas-devel] Trying out liblas

Howard Butler hobu.inc at gmail.com
Fri Sep 19 23:25:12 EDT 2008


On Sep 19, 2008, at 6:07 PM, John Hayes wrote:

> Hello,
>
> I just downloaded liblas 1.0.0b2 and am having some problems.
>
> My end goal is get the scale factors for a bunch of LAS files.  I want
> run the following shell code:
>
> $ for i in *.las; do lasinfo $i | grep "Scale Factor X Y Z" ; done
>
> The first problem is lasinfo always says the scale factors are zero.
> It looks like the scale factors for these LAS files are around 1e-7.
> The following patch fixes the printf formatter.

John,

I have fixed this with your patch:

http://liblas.org/ticket/75

Additionally, you might also try doing this task in Python if it fits:

 >>> import liblas
 >>> f = liblas.file.File('/Users/hobu/svn/liblas/trunk/test/data/ 
srs.las')
 >>> h = f.header
 >>> h.scale
[0.01, 0.01, 0.01]



>
> The next problem is lasinfo prints its output to stderr so the pipe
> does not work.  This seems wrong to me.
>
> Is it safe to change the fprintf(stderr, ... )s to fprintf(stdout,
> ...)s or should I make the caller pass in the output file stream?
>

The correct approach would be for the print_ methods in lascommon.c to  
take in a stream and print to that.  For example, it makes a lot of  
sense for lasinfo to print to stdout when writing summary info, but  
the same code is use to write summary info when you are doing  
operations like las2las (which should be putting stuff to stderr  
because the user may be writing the .las file to stdout or something).

If you register on liblas.org and file a bug, I will try to clean it  
up for the final release (or you can cook up a patch and I'll apply it).

Thanks for trying libLAS, we hope you'll like it.

Howard



More information about the Liblas-devel mailing list