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.LasHeaderType
mutable 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 in

  • file_source_id::UInt16: Numeric identifier for the source that made this file. Set to 0 if the ID is unassigned

  • global_encoding::UInt16: A bit field used to indicate global properties. See the spec for more info

  • guid_1::UInt32: First member of the Project GUID

  • guid_2::UInt16: Second member of the Project GUID

  • guid_3::UInt16: Third member of the Project GUID

  • guid_4::NTuple{8, UInt8}: Fourth member of the Project GUID

  • system_id::NTuple{32, UInt8}: A unique identifier indicating how the data was created

  • software_id::NTuple{32, UInt8}: Identifier for the software that created the LAS file

  • creation_dayofyear::UInt16: The Greenwich Mean Time (GMT) day of the year (as an unsigned short) on which the file was created

  • creation_year::UInt16: Four digit number for the year the file was created

  • header_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 bytes

  • data_offset::UInt32: Offset to the point data (in bytes) from the start of the file to the first field of the first point record

  • n_vlr::UInt32: Number of Variable Length Records (VLR's) in the LAS file. These come after the header and before the point records

  • data_format_id::UInt8: Point data record format stored in the LAS file. LAS v1.4 supports formats 0-10

  • data_record_length::UInt16: Size in bytes of a point data record

  • legacy_record_count::UInt32: For maintaining legacy compatibility, the number of point records in the file (must not exceed typemax(UInt32)). Only populated for point records 0-5

  • legacy_point_return_count::NTuple{5, UInt32}: For maintaining legacy compatibility, the number of points per return (max of 5 returns, counts must not exceed typemax(UInt32)). Only populated for point records 0-5

  • spatial_info::SpatialInfo: Spatial information describing the bounding range of the points, their offsets and any scaling factor applied to them

  • waveform_record_start::UInt64: Offset in bytes from the start of the file to the first byte of the Waveform Data Package Reckord

  • evlr_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 file

  • record_count::UInt64: Number of point records saved in this file (can't exceed typemax(UInt64)). This is populated for LAS v1.4

  • point_return_count::NTuple{15, UInt64}: Number of points per return saved in this file (15 returns total, counts can't exceed typemax(UInt64)). This is populated for LAS v1.4

source

You can access information from the header using any of the following functions:

LASDatasets.number_of_evlrsFunction
number_of_evlrs(h::LasHeader) -> Int64

Get the number of Extended Variable Length Records in a LAS file from a header h

source
LASDatasets.evlr_startFunction
evlr_start(header::LasHeader) -> UInt64

Get the offset in bytes to the first EVLR in a LAS file from a header header

source
LASDatasets.spatial_infoFunction
spatial_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

source
LASDatasets.is_standard_gpsFunction

If 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.

source

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_spatial_info!Function
set_spatial_info!(
    header::LasHeader,
    info::SpatialInfo
) -> SpatialInfo

Set the spatial information associated to points in a LAS file with a header header

source
LASDatasets.set_point_record_length!Function
set_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

source
LASDatasets.set_num_vlr!Function
set_num_vlr!(header::LasHeader, n::Integer) -> UInt64

Set the number of Variable Length Records in a LAS file with a header header

source
LASDatasets.set_num_evlr!Function
set_num_evlr!(header::LasHeader, n::Integer) -> UInt64

Set the number of Extended Variable Length Records in a LAS file with a header header

source
LASDatasets.set_wkt_bit!Function
set_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

source
LASDatasets.unset_wkt_bit!Function
unset_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

source