Lidar::LasFile
Inherits Reference < Object
The main class for dealing with a LAS file data structure.
Constructors
Creates a new LasFile for writing to disc based on a file_name, header, vlr_data, and record_data. The file_mode parameter will be set to "w" for write-access.
file_name = a String containing the name of the file.
header = a LasHeader struct used to initialize the file properties.
vlr_data = an array of VLR structs containing each of the variable length records.
record_data = an array of PointData structs containing the point data.
See also: methods add_header, add_vlr, and add_point_record, which can be used to add these components individually and after initialization using the standard initialize method in "w" file_mode.
Creates a LasFile based on a file_name. The file_mode parameter must equal "r" for read-only, or "w" for write.
Example
file_name = "/path/to/file/data.las"
lf1 = Lidar::LasFile.new file_name, "r"
puts("#{lf1.to_s}") # => prints file header info
puts("#{lf1[100]}") # => prints the 100th point record
new_file = "/path/to/file/newFile.las"
lf2 = Lidar::LasFile.new new_file, "w"
# Add the header
lf2.add_header(lf1.header)
# Add the VLRs to the file
lf1.vlr_data.each do |vlr|
lf2.add_vlr(vlr)
end
# Add the point data to the file
(0...lf1.header.number_of_points).each do |i|
lf2.add_point_record(lf1[i])
end
lf2.write
Instance methods
Sets the properties of the LAS file using a specified LasHeader struct.
Adds a point record (either type 0, 1, 2, or 3) to this LAS file.
Returns the X,Y,Z, and intensity data for a specified point_num.
Gets and sets the variable length record (VLR) array associated with this LasFile.
Writes the header, variable length records (VLRs), and point data of the LAS file to disc.