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

Mateusz Loskot mateusz at loskot.net
Thu Sep 25 13:23:29 EDT 2008


Erik Jacobsen wrote:
>
> 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,

Thank you for this report and patch.
Certainly, your analysis is correct and we have a bug in libLAS.

I've submitted your report as ticket on the libLAS Trac adding your e-mail
to CC:

http://liblas.org/ticket/76

I will fix it tonight when I'm back home.

Best regards,
-- 
Mateusz Loskot
http://mateusz.loskot.net




More information about the Liblas-devel mailing list