Header
Each LAS file starts with a block of header information that contains metadata for the whole file. LASDatasets.jl uses the LasHeader
struct to wrap around this data and defines a user-friendly interface to modify certain aspects of it.
LASDatasets.LasHeader
— Typemutable struct LasHeader
A LAS Header containing metadata regarding information in a LAS file See full specification here
las_version::VersionNumber
: The LAS spec version this header was written infile_source_id::UInt16
: Numeric identifier for the source that made this file. Set to 0 if the ID is unassignedglobal_encoding::UInt16
: A bit field used to indicate global properties. See the spec for more infoguid_1::UInt32
: First member of the Project GUIDguid_2::UInt16
: Second member of the Project GUIDguid_3::UInt16
: Third member of the Project GUIDguid_4::NTuple{8, UInt8}
: Fourth member of the Project GUIDsystem_id::NTuple{32, UInt8}
: A unique identifier indicating how the data was createdsoftware_id::NTuple{32, UInt8}
: Identifier for the software that created the LAS filecreation_dayofyear::UInt16
: The Greenwich Mean Time (GMT) day of the year (as an unsigned short) on which the file was createdcreation_year::UInt16
: Four digit number for the year the file was createdheader_size::UInt16
: Size (in bytes) of the public header block in the LAS file. This varies depending on which LAS version was used to write it. For LAS v1.4 it's 375 bytesdata_offset::UInt32
: Offset to the point data (in bytes) from the start of the file to the first field of the first point recordn_vlr::UInt32
: Number of Variable Length Records (VLR's) in the LAS file. These come after the header and before the point recordsdata_format_id::UInt8
: Point data record format stored in the LAS file. LAS v1.4 supports formats 0-10data_record_length::UInt16
: Size in bytes of a point data recordlegacy_record_count::UInt32
: For maintaining legacy compatibility, the number of point records in the file (must not exceedtypemax(UInt32)
). Only populated for point records 0-5legacy_point_return_count::NTuple{5, UInt32}
: For maintaining legacy compatibility, the number of points per return (max of 5 returns, counts must not exceedtypemax(UInt32)
). Only populated for point records 0-5spatial_info::SpatialInfo
: Spatial information describing the bounding range of the points, their offsets and any scaling factor applied to themwaveform_record_start::UInt64
: Offset in bytes from the start of the file to the first byte of the Waveform Data Package Reckordevlr_start::UInt64
: Offset in bytes from the start of the file to the first byte of the first Extended Variable Length Record (EVLR)n_evlr::UInt32
: Number of EVLR's in the LAS filerecord_count::UInt64
: Number of point records saved in this file (can't exceedtypemax(UInt64)
). This is populated for LAS v1.4point_return_count::NTuple{15, UInt64}
: Number of points per return saved in this file (15 returns total, counts can't exceedtypemax(UInt64)
). This is populated for LAS v1.4
You can access information from the header using any of the following functions:
LASDatasets.las_version
— Functionlas_version(h::LasHeader) -> VersionNumber
Get the LAS specification version from a header h
LASDatasets.file_source_id
— Functionfile_source_id(h::LasHeader) -> UInt16
Get the file source ID specification version from a header h
LASDatasets.global_encoding
— Functionglobal_encoding(h::LasHeader) -> UInt16
Get the global properties bit vector from a header h
LASDatasets.system_id
— Functionsystem_id(h::LasHeader) -> String
Get the system ID from a header h
LASDatasets.software_id
— Functionsoftware_id(h::LasHeader) -> String
Get the software ID from a header h
LASDatasets.creation_day_of_year
— Functioncreation_day_of_year(h::LasHeader) -> UInt16
Get the creation day of the year from a header h
LASDatasets.creation_year
— Functioncreation_year(h::LasHeader) -> UInt16
Get the creation year from a header h
LASDatasets.header_size
— Functionheader_size(h::LasHeader) -> Int64
Get the size of a header h
in bytes
LASDatasets.point_data_offset
— Functionpoint_data_offset(h::LasHeader) -> Int64
Get the offset to the first point record in a LAS file specified by a header h
LASDatasets.point_record_length
— Functionpoint_record_length(h::LasHeader) -> Int64
Get the number of bytes assigned to each point record in a LAS file specified by a header h
LASDatasets.point_format
— Functionpoint_format(header::LasHeader) -> Any
Get the LAS point format from a header header
LASDatasets.number_of_points
— Functionnumber_of_points(h::LasHeader) -> Int64
Get the number of points in a LAS file from a header h
LASDatasets.get_number_of_points_by_return
— Functionget_number_of_points_by_return(
header::LasHeader
) -> Union{NTuple{5, UInt32}, NTuple{15, UInt64}}
Get the number of points per return for a header header
LASDatasets.number_of_vlrs
— Functionnumber_of_vlrs(h::LasHeader) -> Int64
Get the number of Variable Length Records in a LAS file from a header h
LASDatasets.number_of_evlrs
— Functionnumber_of_evlrs(h::LasHeader) -> Int64
Get the number of Extended Variable Length Records in a LAS file from a header h
LASDatasets.evlr_start
— Functionevlr_start(header::LasHeader) -> UInt64
Get the offset in bytes to the first EVLR in a LAS file from a header header
LASDatasets.spatial_info
— Functionspatial_info(h::LasHeader) -> SpatialInfo
Get the spatial information for point positions in a LAS file from a header h
. This includes the offsets/scale factors applied to points and bounding box information
LASDatasets.num_return_channels
— Functionnum_return_channels(h::LasHeader) -> Int64
Get the number of return channels in a LAS file from a header h
LASDatasets.is_standard_gps
— FunctionIf true, GPS Time is standard GPS Time (satellite GPS Time) minus 1e9. If false, GPS Time is GPS Week Time.
Note that not all software sets this encoding correctly.
LASDatasets.is_wkt
— FunctionCheck if the projection information is in WKT format (true) or GeoTIFF (false)
LASDatasets.is_internal_waveform
— Functionis_internal_waveform(header::LasHeader) -> Bool
Returns whether a LAS file with header header
has waveform data stored in the LAS file
LASDatasets.is_external_waveform
— Functionis_external_waveform(header::LasHeader) -> Bool
Returns whether a LAS file with header header
has waveform data in an external file
LASDatasets.waveform_record_start
— Functionwaveform_record_start(header::LasHeader) -> UInt64
Get the offset in bytes to the first waveform record for a LAS file with header header
You can also modify certain fields in the header, but one should note that for some of these fields, such as those impacting the byte layout of the LAS file itself, it's better to let the system do it automatically so that your header remains consistent with your dataset.
LASDatasets.set_las_version!
— Functionset_las_version!(h::LasHeader, v::VersionNumber)
Set the LAS specification version in a header h
to version v
LASDatasets.set_point_format!
— Functionset_point_format!(h::LasHeader, _::Type{TPoint<:LasPoint})
Set the point format in a header h
to a new value, TPoint
LASDatasets.set_spatial_info!
— Functionset_spatial_info!(
header::LasHeader,
info::SpatialInfo
) -> SpatialInfo
Set the spatial information associated to points in a LAS file with a header header
LASDatasets.set_point_data_offset!
— Functionset_point_data_offset!(
header::LasHeader,
offset::Integer
) -> UInt32
Set offset to the first point record in a LAS file with a header header
LASDatasets.set_point_record_length!
— Functionset_point_record_length!(
header::LasHeader,
length::Integer
) -> UInt16
Set the number of bytes associated to each point record in a LAS file with a header header
LASDatasets.set_point_record_count!
— Functionset_point_record_count!(
header::LasHeader,
num_points::Integer
)
Set the number of points in a LAS file with a header header
LASDatasets.set_num_vlr!
— Functionset_num_vlr!(header::LasHeader, n::Integer) -> UInt64
Set the number of Variable Length Records in a LAS file with a header header
LASDatasets.set_num_evlr!
— Functionset_num_evlr!(header::LasHeader, n::Integer) -> UInt64
Set the number of Extended Variable Length Records in a LAS file with a header header
LASDatasets.set_gps_week_time_bit!
— Functionset_gps_week_time_bit!(header::LasHeader) -> UInt16
Sets the bit flag indicating that the header header
is in GPS week time
LASDatasets.set_gps_standard_time_bit!
— Functionset_gps_standard_time_bit!(header::LasHeader) -> UInt16
Sets the bit flag indicating that the header header
is in GPS standard time
LASDatasets.set_waveform_internal_bit!
— Functionset_waveform_internal_bit!(header::LasHeader) -> UInt16
Sets the bit flag indicating that the header header
has internal waveform records
LASDatasets.set_waveform_external_bit!
— Functionset_waveform_external_bit!(header::LasHeader) -> UInt16
Sets the bit flag indicating that the header header
has external waveform records
LASDatasets.set_synthetic_return_numbers_bit!
— Functionset_synthetic_return_numbers_bit!(
header::LasHeader
) -> UInt16
Sets the bit flag indicating that the header header
has synthetically-generated return numbers
LASDatasets.unset_synthetic_return_numbers_bit!
— Functionunset_synthetic_return_numbers_bit!(
header::LasHeader
) -> UInt16
Sets the bit flag indicating that the header header
does not have synthetically-generated return numbers
LASDatasets.set_wkt_bit!
— Functionset_wkt_bit!(header::LasHeader) -> UInt16
Sets the bit flag indicating that the LAS file with header header
has its coordinate reference system set as a WKT
LASDatasets.unset_wkt_bit!
— Functionunset_wkt_bit!(header::LasHeader) -> UInt16
Sets the bit flag indicating that the LAS file with header header
doesn't have its coordinate reference system set as a WKT
LASDatasets.set_number_of_points_by_return!
— Functionset_number_of_points_by_return!(
header::LasHeader,
points_per_return::NTuple{N, Integer}
)
Set the number of points per return for a header header
to the values points_per_return