Re: [LAStools] Las convert GPS standard time to date

2,884 views
Skip to first unread message

Gottfried Mandlburger

unread,
Apr 24, 2013, 6:50:37 AM4/24/13
to last...@googlegroups.com
Arnaud,

Time stamps are either stored in GPS week seconds or Adjusted Standard GPS Time (i.e., Standard GPS Time - 1 * 10**9 sec) depending on the "Global Encoding Bit 0" of the LAS Public Header. Thus, I assume, your time stamps are in Adjusted GPS Time:

ad GPS time: Global Positioning System time, is the atomic time scale implemented by the atomic clocks in the GPS ground control stations and the GPS satellites themselves. GPS time was zero at 0h 6-Jan-1980 and since it is not perturbed by leap seconds GPS is now ahead of UTC by 16 seconds (source http://leapsecond.com/java/gpsclock.htm).

On 24.04.2013 12:20, Arnaud wrote:
For example :
Timestamps= 40300791.149484
Flying date was : 23/12/2012

At a one second level this is equivalent to:

Standard GPS Time = 1040300791
Unix Time = 356265591
UTC: Dec 23, 2012, 12:26:15

There are a couple of GPS time converters available  Just Google for "GPS time converter"

Kind regards,
Gottfried

---
visit us at: www.ipf.tuwien.ac.at/opals

 

Do somebody knows how to convert it?
Thank you for your help, 

Arnaud
--
Download LAStools at
http://lastools.org
http://rapidlasso.com
Be social with LAStools at
http://facebook.com/LAStools
http://twitter.com/LAStools
http://linkedin.com/groups/LAStools-4408378
Manage your settings at
http://groups.google.com/group/lastools/subscribe
 
 


-- 
Dr. Gottfried Mandlburger

Tel.: +43 1 58801 12235
Fax.: +43 1 58801 12299
http://www.ipf.tuwien.ac.at
    _____ _____ _____
   /____// ___//    /  Vienna University of Technology
  // __ / /__ / // /  Department of Geodesy and Geoinformation
 //__/// /__ / // /  Research Groups Photogrammetry and Remote Sensing
/____//____//____/  Gusshausstrasse 27-29, A-1040 Vienna

Evon Silvia

unread,
Apr 24, 2013, 11:52:54 AM4/24/13
to last...@googlegroups.com
Some versions of TerraScan (and other software) improperly encode the file as "GPS Week Time" instead of "Adjusted Standard GPS Time." We've run into that issue before. If while looking through your points you notice any negative timestamps or any timestamps in excess of the number of seconds in a week (604,800), then you can be sure that you have Adjusted Standard GPS Time.

Evon

--
Evon Silvia 
Geomatics Engineer

WSI Corvallis, OR WSI Portland, OR WSI Oakland, CA
517 SW 2nd St., Suite 400, Corvallis, OR 97333




On Wed, Apr 24, 2013 at 8:49 AM, Arnaud <arn....@gmail.com> wrote:

Thank you Gottfried for your help,
 


Your example seems correct :

Standard GPS Time = 1040300791 
UTC: Dec 23, 2012, 12:26:15 

1040300791 / (365x24x60x60) = 32.99
 
So it corresponds to the number of seconds between '6jan1980' and '23dec2012'
 


But the thing is that the las project is made by TerraScan, and the time is supposed to be in "Standard GPS Time". 
But for the 23rd of December, my time stamps is equal to  40300791.149484, (completely different to the real GPS time - 1040300791)
 
So how is this time stamps coding? How can I get the date?
 
I already wrote to TerraSolid, but I am not sure I would have an answer...

 

Thanks a lot for your help !

Evon Silvia

unread,
Apr 24, 2013, 11:58:46 AM4/24/13
to last...@googlegroups.com
I just read your email again and realized that that didn't answer your question. LAS files store "Adjusted Standard GPS Time", meaning that the times were offset by 1x10^9 to make timestamps center around zero for a decade or two. Thus the difference you are seeing between "real" GPS Time and your timestamps.

Evon

Małgorzata

unread,
Oct 17, 2013, 9:23:49 AM10/17/13
to last...@googlegroups.com
Hello,

I have the same problem as Arnaud. Reading Gottfried's answer I still can't find the right flying time of the las project. 

My example:
Flying date: 04/09/2012
Time stamp 30798208.729495

If somebody could explain me how to convert it on my example I would be very thankful :)

Małgorzata

Kirk Waters - NOAA Federal

unread,
Oct 17, 2013, 11:05:17 AM10/17/13
to last...@googlegroups.com
Below is a little perl script that will do it on a *nix box (or an OS that has the gmtime function). It isn't perfect since it doesn't account for the leap seconds (so around 6 seconds off). Running your example I get:
1346763008.729495 => 20120904 12:50:08
where 20120904 is YYYYMMDD format. Time is in UTC. Substitute localtime for gmtime below to get in the machine's local time zone.

#!/usr/bin/perl
$JAN6_1980 = 315964800; #Seconds between Jan 1, 1970 (POSIX time zero) and Jan 6, 1980 (GPS time zero
)
$GPS_OFFSET = 1e9;

while(<>)
{
  $gps = $_;
  if($gps >= 0  && $gps < 7*86400){ # could be seconds of the week
    print "Value $gps may be seconds of the week\n";
  }
  $gps += $JAN6_1980 + $GPS_OFFSET;

  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($gps);
  printf("%f => %04d%02d%02d %02d:%02d:%02d\n",$gps,$year+1900,$mon+1,$mday,$hour,$min,$sec);
}


Kirk Waters, PhD
NOAA Coastal Services Center
843-740-1227

teons

unread,
Aug 28, 2014, 7:46:08 AM8/28/14
to last...@googlegroups.com
Could you explain why we must add 10 befor 40300791.
I am looking for rules

W dniu środa, 24 kwietnia 2013 17:49:34 UTC+2 użytkownik Arnaud napisał:

Thank you Gottfried for your help,
 


Your example seems correct :

Standard GPS Time = 1040300791 
UTC: Dec 23, 2012, 12:26:15 

1040300791 / (365x24x60x60) = 32.99
Reply all
Reply to author
Forward
0 new messages