[Liblas-devel] Trying out liblas

John Hayes jahayes at gmail.com
Fri Sep 19 19:07:31 EDT 2008


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.

--- a/apps/lascommon.c  Fri Sep 19 15:17:56 2008 -0700
+++ b/apps/lascommon.c  Fri Sep 19 15:34:47 2008 -0700
@@ -416,7 +416,7 @@
                     LASHeader_GetPointRecordsByReturnCount(header, 3),
                     LASHeader_GetPointRecordsByReturnCount(header, 4));

-    fprintf(stderr, "  Scale Factor X Y Z         %.6f %.6f %.6f\n",
+    fprintf(stderr, "  Scale Factor X Y Z         %.6g %.6g %.6g\n",
                     LASHeader_GetScaleX(header),
                     LASHeader_GetScaleY(header),
                     LASHeader_GetScaleZ(header));


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?

-john

John Hayes



More information about the Liblas-devel mailing list