[Liblas-devel] Patch for utility.hpp for negative elevations

Erik Jacobsen jacobsen at powline.com
Thu Sep 25 11:32:47 EDT 2008


Hello All,

First, I would like to thank the developers for this excellent library.  
It has been easy to use, particularly after the addition of makefile.vc.

I have been trying it with various data sets and have discovered what 
appears to be a bug.  The data set in question contains points that are 
below sea level (i.e. z values are negative).  After reading with 
liblas, the z values are instead ~4 billion.  This was with 1.0.0b1, so 
I downloaded trunk-r878 and duplicated the problem.  When stepping 
through the code I discovered that the coordinates are being stored in a 
uint32_t instead of an int32_t.  The LAS 1.1 specification for "POINT 
DATA RECORD FORMAT 0" states that X, Y and Z are stored in "long" which 
is defined to be a signed 4 byte quantity (page 6).  The following patch 
solves the problem and produces sane results:

C:\dev\LAS\trunk\include\liblas\detail>"C:\Program Files 
(x86)\GnuWin32\bin\diff.exe" util
ity.hpp C:\dev\las\utility.hpp
185,187c185,187
<     int32_t x;
<     int32_t y;
<     int32_t z;
---
 >     uint32_t x;
 >     uint32_t y;
 >     uint32_t z;

Please consider including it in the trunk.

Thank you,

Erik

-- 
Erik Jacobsen, Power Line Systems, Inc.
Email: jacobsen at powline.com
Phone: (608) 238-2171 x104
Fax:   (608) 238-9241
Web:   http://www.powline.com/




More information about the Liblas-devel mailing list