[Liblas-devel] GPS time and intensity?

Howard Butler hobu.inc at gmail.com
Mon Oct 13 22:18:11 EDT 2008


We need to clip the microseconds to 999999 if it overflows:

Change the get_time implementation to look like:

     def get_time(self):
         t = core.las.LASPoint_GetTime(self.handle)
         floor = math.floor(t)
         ms = float(t) - floor

         # clip to 999999
         ms = int(round(ms* 1000000 ))
         if ms > 999999:
             ms = 999999

         lt = time.gmtime(t)
         value =  
datetime.datetime(lt[0],lt[1],lt[2],lt[3],lt[4],lt[5],ms)
         return value

This has already been implemented in trunk and backported to the 1.0  
branch.  Thanks for the report!

Howard


On Oct 13, 2008, at 7:34 PM, Jason Woolard wrote:

> Hi,
>
> The time update seems to be working fine with my files but I was  
> able to raise an error with the sample  
> Serpent_Mound_Model_LAS_Data.las file from Martin's site.
>
> The error is:
>
> File "C:\Python25\lib\site-packages\liblas\point.py", line 185, in  
> get_time
>   return datetime.datetime(lt[0],lt[1],lt[2],lt[3],lt[4],lt[5],ms)
> ValueError: microsecond must be in 0..999999
>
> The Serpent LAS sample does have data to 6 decimal places while my  
> files only have data to three places. Other than that the files seem  
> to be the same.
>
> Howard Butler wrote:
>>
>> On Oct 13, 2008, at 1:13 PM, Jason Woolard wrote:
>>>
>>> On the GPS time issue, I think it's definitely important to have  
>>> more precision than the nearest second. The GPS/Inertial or  
>>> trajectory data is usually measured at ~200 Hz and one of the  
>>> useful things about having the GPS time stamp is the ability to  
>>> match up a particular pulse with the corresponding time in the  
>>> vehicle trajectory or scanner angle data. Commercial topographic  
>>> lidar systems are now pulsing at 100 kHz + so having the times  
>>> rounded to a second would mean you could potentially have 100,000  
>>> points or more with identical times. In addition, the time stamp  
>>> will be even more important as laser waveform data becomes more  
>>> mainstream.
>>
>> Jason,
>>
>> After thinking about this a bit, I think the problem is just  
>> related to the Python bindings throwing out the fractional  
>> seconds.  I took a crack at fixing this in the Python bindings
>>
>> http://liblas.org/changeset/945
>>
>> Here's a ticked to track the changes:
>>
>> http://liblas.org/ticket/83
>>
>> If you could use subversion to build from trunk or the 1.0 branch  
>> and test that things are behaving correctly, it would be greatly  
>> appreciated.
>>
>> Thanks,
>>
>> Howard




More information about the Liblas-devel mailing list