[Liblas-devel] Precision of reprojection transforms

Howard Butler hobu.inc at gmail.com
Fri Apr 29 11:46:11 EDT 2011


On Apr 29, 2011, at 10:39 AM, Edwards, David wrote:

>> The problem is related to the formatting, but it is actually the data
>> scaling, not the formatting.  X, Y, and Z coordinates in LAS are stored
>> as scaled integers.  Your X, Y, Z values of your UTM data have two
>> decimals of precision as defined by the scale and offset in the LAS
>> file's header.  Reprojecting the data into DD causes the data to be
>> descaled into doubles, reprojected, and then scaled back by the
>> scale/offset values of the point's header (in this case 0.01 for X/Y).
>> This results in not enough precision, obviously.
>> 
>> You need to tell the ReprojectionTransform about what it should use for
>> the scale/offset of the output data.  You can do this by creating a
>> copy of your header, setting the scale/offset to what you need, and
>> then giving a shared_ptr of that to the ReprojectionTransform
>> constructor.  See line 1332 of apps/laskernel.cpp for an example.
>> 
>> Hope this helps,
>> 
>> Howard
> 
> Thanks for your help, this solution solved my problem.  I wasn't aware that the reprojection transform was using the scale factors from the input file header.

The points themselves carry a reference to their header as they were read from the file.  Giving this to the reprojection transform changes that reference (actually a shared_ptr right now, but that is going to change to a real reference in an upcoming release).

Glad you're going,

Howard



More information about the Liblas-devel mailing list