[Liblas-commits] hg: header accounting

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Feb 18 11:25:24 EST 2011


details:   http://hg.liblas.orghg/rev/745106b04cc4
changeset: 2869:745106b04cc4
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Feb 18 10:25:18 2011 -0600
description:
header accounting

diffstat:

 python/scripts/oci2las.py |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (65 lines):

diff -r c71f4e0b0e9c -r 745106b04cc4 python/scripts/oci2las.py
--- a/python/scripts/oci2las.py	Fri Feb 18 10:02:35 2011 -0600
+++ b/python/scripts/oci2las.py	Fri Feb 18 10:25:18 2011 -0600
@@ -115,6 +115,7 @@
         self.count = 0
         self.first_point = True
         self.cloud_column = True
+        self.header = None
         
         if self.options.srs:
             self.srs = srs.SRS()
@@ -147,6 +148,7 @@
             d = struct.unpack(format,blob[ptsize*i:ptsize*(i+1)])
             x, y, z, time, classification, blk_id, pt_id = d
             p = point.Point()
+            p.header = self.header
             p.x = x; p.y = y; p.z = z
             p.classification = int(classification)
             p.raw_time = time
@@ -179,22 +181,22 @@
         pass
     
     def open_output(self):
-        h = header.Header()
+        self.header = header.Header()
         
         prec = 10**-(self.options.precision-1)
-        h.scale = [prec, prec, prec]
+        self.header.scale = [prec, prec, prec]
         
         if self.options.offset:
             h.offset = [self.min.x, self.min.y, self.min.z]
             if self.options.verbose:
                 print 'using minimum offsets', h.offset
 
-        h.compressed = self.options.compressed
+        self.header.compressed = self.options.compressed
  
         if self.srs:
-            h.srs = self.srs
+            self.header.srs = self.srs
             
-        output = lasfile.File(self.options.output,mode='w',header=h)
+        output = lasfile.File(self.options.output,mode='w',header=self.header)
         return output
     
     def write_points(self, points):
@@ -275,6 +277,9 @@
         clouds = None
         points = []
         print 'have srs?: %s' % bool(self.srs)
+
+        self.output = self.open_output()
+
         if not clouds:
             cur = self.cur.execute(self.options.sql)
             num_pts_index, blob_index = self.get_block_indexes(cur)
@@ -297,7 +302,6 @@
                     if not self.srs:
                         self.srs = srs.SRS()
 
-        self.output = self.open_output()
         for pts in points:
             self.write_points(pts)
         


More information about the Liblas-commits mailing list