Changeset 661:c95ab1a80f49


Ignore:
Timestamp:
05/18/08 22:16:30 (2 years ago)
Author:
Howard Butler <hobu.inc@…>
Branch:
default
Convert:
svn:1766ff46-f334-0410-ab20-d63176f87757/trunk@728
Message:

some VLR stuff

Location:
python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • python/liblas/header.py

    r657 r661  
    352352        return core.las.LASHeader_SetProj4(self.handle, value) 
    353353    proj4 = property(get_proj4, set_proj4) 
     354     
     355    def GetVLR(self, value): 
     356        return vlr.VLR(handle=core.las.LASHeader_GetVLR(self.handle, value)) 
     357 
     358 
  • python/liblas/vlr.py

    r657 r661  
    4242 """ 
    4343import core 
     44import ctypes 
    4445 
    4546class VLR(object): 
     
    8485        return core.las.LASVLR_SetReserved(self.handle, value) 
    8586    reserved = property(get_reserved, set_reserved) 
     87     
     88    def get_data(self): 
     89        b = ctypes.pointer(ctypes.c_ubyte()) 
     90        i = ctypes.pointer(ctypes.c_int()) 
     91        core.las.LASVLR_GetData(self.handle, ctypes.byref(b), i) 
     92        print 'i length: %s' % i.contents.value 
     93        print 'bvalue : %s' % b.contents 
     94 
     95        t = (ctypes.c_byte*i.contents.value)() 
     96        print 'b[0:71]: ', b[0:i.contents.value] 
     97        parray = ctypes.cast(b, ctypes.c_void_p(i.contents.value)) 
     98        print 'parray value' , parray[0:i.contents.value] 
     99 
     100        o = ''.join([chr(b[i]) for i in range(i.contents.value)]) 
     101        print 'o: ', o 
     102        print 'type(parray): ', type(parray) 
     103#        buf = ctypes.create_string_buffer(i.value) 
     104#        print type(buf) 
     105        return ctypes.cast(b, ctypes.c_char_p).value 
     106#        return ctypes.create_string_buffer(parray, i.contents.value)[:] 
     107    data = property(get_data) 
     108 
  • python/tests/VLR.txt

    r657 r661  
    1919  >>> v.description 
    2020  'libLAS' 
     21   
     22  >>> from liblas import file 
     23  >>> f = file.File('../test/data/srs.las') 
     24  >>> h = f.header 
     25  >>> h.records_count 
     26  3L 
     27  >>> h.proj4 
     28  '+proj=utm +zone=17 +ellps=WGS84 +units=m ' 
     29  >>> v = h.GetVLR(0) 
     30  >>> v.recordid 
     31  34735 
     32  >>> v.userid 
     33  'LASF_Projection' 
     34   
     35  >>> data = v.data 
     36  >>> len(data) 
     37 
Note: See TracChangeset for help on using the changeset viewer.