[Liblas-devel] Writing VLR?

Jason Woolard Jason.Woolard at noaa.gov
Sun Nov 2 14:27:10 EST 2008


The "test" docs on the Trac page have been very helpful but does anyone 
have an example of writing a VLR. It seems that I can create a VLR and 
update it (see below) but I can't write it to the file. I tried writing 
a point to the file which works for updating the proj4 header tag but 
I'm guessing the VLR requires something different.

 >>> import liblas
 >>> from liblas import file
 >>> from liblas import header
 >>> from liblas import vlr
 >>> input = liblas.file.File('C:\\liblas_test\\debug_new.las',mode='r')
 >>> h = input.header
 >>> h.records_count
 >>> h.proj4
'+proj=tmerc +lat_0=0.000000000 +lon_0=-81.000000000 +k=0.999600 
+x_0=500000.000 +y_0=0.000 +ellps=WGS84 +units=m '
 >>> v = h.GetVLR(0)
 >>> v.recordid
 >>> v.userid
 >>> v.description
 >>> v.description = 'UTM zone 17 meters WGS84'
 >>> v.description
'UTM zone 17 meters WGS84'
 >>> output = 
 >>> output.write(input.read(0))
 >>> output.close()

More information about the Liblas-devel mailing list