[Liblas-devel] VLR in liblas 1.6.0 crashing

Howard Butler hobu.inc at gmail.com
Wed Jun 22 10:50:35 EDT 2011


On Mar 10, 2011, at 4:33 PM, Sullivan, Alicia wrote:
> And tried to open the new file 'las12_example_vlr.las', it crashed with the same error as my file. Does anyone know if this is a known bug? Are there any work arounds or a newer python version that I can use where this is fixed?

Alicia,

I am sorry it has taken so long to get to this.  I have just run a test with the following code using the latest code based (soon to be released as libLAS 1.7.0) that appears to work just fine.  Note that I am also writing actual data into the VLR.  At one time, VLRs without data weren't valid and this might have been the issue with your example. Hopefully this gremlin is gone for you with the next release.

Howard


> from liblas import file as lasfile
> from liblas import vlr
> from liblas import header as lasheader
>  
> f = lasfile.File('../test/data/1.2_2.las',None,'rb')
> h = f.header
>  
> v = vlr.VLR()
>  
> v.userid='Alicia'
> v.recordid = 12345
> 
> v.recordlength = 256
> 
> import ctypes
> data = (ctypes.c_ubyte * 256)()
> 
> for i in range(256):
>     data[i] = 2+i
>   
> v.data = data
> 
> h.add_vlr(v)
>  
> f2 = lasfile.File('las12_example_vlr.las',header=h,mode='w')
> for p in f:
>     f2.write(p)
> f2.close()


> fire:python hobu$ lasinfo las12_example_vlr.las 
> ---------------------------------------------------------
>   Header Summary
> ---------------------------------------------------------
> 
>   Version:                     1.2
>   Source ID:                   0
>   Reserved:                    0
>   Project ID/GUID:             '8388f1b8-aa1b-4108-bca3-6bc68e7b062e'
>   System ID:                   'libLAS'
>   Generating Software:         'libLAS 1.2'
>   File Creation Day/Year:      78/2008
>   Header Byte Size             227
>   Data Offset:                 748
>   Number Var. Length Records:  3
>   Point Data Format:           2
>   Number of Point Records:     1
>   Compressed:                  False
>   Number of Points by Return:  0 1 0 0 0 
>   Scale Factor X Y Z:          0.01 0.01 0.01
>   Offset X Y Z:                0.00 0.00 0.00
>   Min X Y Z:                   470692.45 4602888.90 16.00
>   Max X Y Z:                   470692.45 4602888.90 16.00
>   Spatial Reference:           
> Reference defined with VLR keys, but GeoTIFF and GDAL support are not available to produce definition
> 
> Reference defined with VLR keys, but GeoTIFF and GDAL support are not available to produce definition
> 
> ---------------------------------------------------------
>   VLR Summary
> ---------------------------------------------------------
>     User: 'Alicia' - Description: ''
>     ID: 12345 Length: 256
>     User: 'LASF_Projection' - Description: ''
>     ID: 34735 Length: 64
>     User: 'LASF_Projection' - Description: ''
>     ID: 34737 Length: 39
> ---------------------------------------------------------
>   Schema Summary
> ---------------------------------------------------------
>   Point Format ID:             2
>   Number of dimensions:        15
>   Custom schema?:              false
>   Size in bytes:               26
> 
>   Dimensions
> ---------------------------------------------------------
>   'X'                            --  size: 32 offset: 0
>   'Y'                            --  size: 32 offset: 4
>   'Z'                            --  size: 32 offset: 8
>   'Intensity'                    --  size: 16 offset: 12
>   'Return Number'                --  size: 3 offset: 14
>   'Number of Returns'            --  size: 3 offset: 14
>   'Scan Direction'               --  size: 1 offset: 14
>   'Flightline Edge'              --  size: 1 offset: 14
>   'Classification'               --  size: 8 offset: 15
>   'Scan Angle Rank'              --  size: 8 offset: 16
>   'User Data'                    --  size: 8 offset: 17
>   'Point Source ID'              --  size: 16 offset: 18
>   'Red'                          --  size: 16 offset: 20
>   'Green'                        --  size: 16 offset: 22
>   'Blue'                         --  size: 16 offset: 24
>   
> ---------------------------------------------------------
>   Point Inspection Summary
> ---------------------------------------------------------
>   Header Point Count: 1
>   Actual Point Count: 1
> 
>   Minimum and Maximum Attributes (min,max)
> ---------------------------------------------------------
>   Min X, Y, Z: 		470692.44, 4602888.90, 16.00
>   Max X, Y, Z: 		470692.44, 4602888.90, 16.00
>   Bounding Box:		470692.44, 4602888.90, 470692.44, 4602888.90
>   Time:			0.000000, 0.000000
>   Return Number:	2, 2
>   Return Count:		0, 0
>   Flightline Edge:	0, 0
>   Intensity:		0, 0
>   Scan Direction Flag:	0, 0
>   Scan Angle Rank:	-13, -13
>   Classification:	2, 2
>   Point Source Id:	0, 0
>   User Data:		0, 0
>   Minimum Color (RGB):	255 12 234 
>   Maximum Color (RGB):	255 12 234 
> 
>   Number of Points by Return
> ---------------------------------------------------------
> 	(2) 1
> 
>   Number of Returns by Pulse
> ---------------------------------------------------------
> 	(0) 1
> 
>   Point Classifications
> ---------------------------------------------------------
> 	1 Ground (2) 
>   -------------------------------------------------------
>   	0 withheld
>   	0 keypoint
>   	0 synthetic
>   -------------------------------------------------------
> 



More information about the Liblas-devel mailing list