visr / LasIO.jl

Julia package for reading and writing the LAS lidar format.
Other
22 stars 13 forks source link

more name flame war - LazIO headers vs LasIO headers #29

Closed Crghilardi closed 4 years ago

Crghilardi commented 4 years ago

I kept getting errors when I tried to call header.x_scale_factor on a .las header before I realized there are many fields names that change between LasIO and LazIO. It would be nice to synchronize these.

:fire: oorlog van vlammen :fire:

using FileIO, LasIO
lasfn = joinpath(dirname(pathof(LasIO)), "..", "test/libLAS_1.2.las")
header, points = load(lasfn)

julia> fieldnames(typeof(header))
(:file_source_id, :global_encoding, :guid_1, :guid_2, :guid_3, :guid_4, :version_major, :version_minor, :system_id, :software_id, :creation_dayofyear, :creation_year, :header_size, :data_offset, :n_vlr, :data_format_id, :data_record_length, :records_count, :point_return_count, :x_scale, :y_scale, :z_scale, :x_offset, :y_offset, :z_offset, :x_max, :x_min, :y_max, :y_min, :z_max, :z_min, :variable_length_records, :user_defined_bytes)
using LazIO
lazfn = joinpath(dirname(pathof(LazIO)), "..", "test/libLAS_1.2.laz")
pointcloud = LazIO.open(lazfn)

julia>fieldnames(typeof(pointcloud.header))
(:file_source_ID, :global_encoding, :project_ID_GUID_data_1, :project_ID_GUID_data_2, :project_ID_GUID_data_3, :project_ID_GUID_data_4, :version_major, :version_minor, :system_identifier, :generating_software, :file_creation_day, :file_creation_year, :header_size, :offset_to_point_data, :number_of_variable_length_records, :point_data_format, :point_data_record_length, :number_of_point_records, :number_of_points_by_return, :x_scale_factor, :y_scale_factor, :z_scale_factor, :x_offset, :y_offset, :z_offset, :max_x, :min_x, :max_y, :min_y, :max_z, :min_z, :start_of_waveform_data_packet_record, :start_of_first_extended_variable_length_record, :number_of_extended_variable_length_records, :extended_number_of_point_records, :extended_number_of_points_by_return, :user_data_in_header_size, :user_data_in_header, :vlrs, :user_data_after_header_size, :user_data_after_header)
evetion commented 4 years ago

Nice try :man_firefighter:

LasIO uses its own headers and points, specific for the LAS version. LazIO uses the struct as defined by laszip itself, which is version independent.

You can easily convert from LazHeader to LasHeader using https://github.com/evetion/LazIO.jl/blob/master/src/convert.jl.

visr commented 4 years ago

Ha. Yeah for LasIO names I followed laspy names mostly, which adapt the spec names to lower_case variable names.

Crghilardi commented 4 years ago

OK, I did not know aboutLazIO.LasHeader(pointcloud.header) :+1: I just have to pay attention to which package I am using.

At least you can say the packages are well tested :man_mechanic: