Header Module
The laspy header module holds the low level laspy.header.Header class, which both stores header information during a laspy session, and also provides a container for moving header data around. Most of the header API is located in the laspy.header.HeaderManager class, which holds a laspy.header.Header instance. This is accessed from a laspy.file.File object as laspy.file.File.header
Additionally, this module holds the VLR and EVLR classes, for regular and extended variable length records as defined in the various LAS specifications.
Finally, this module provides ExtraBytesStruct, which is a frontend for defining additional dimensions in the LAS file via an Extra Bytes type VLR. See the tutorial for an example of this (the LAS specification is also a helpful reference.)
This class provides a frontend for the Extra Bytes Struct as defined in the LAS 1.4 specification. All Arguments are assumed to be default values unless specified - the two really key ones are name and data_type. This structure lives in the VLR_body property of a laspy.header.VLR instance, and multiple ExtraByteStruct records can be present together. Each ExtraBytesStruct instance describes an additional dimension present at the end of each point record.
An extended VLR as defined in LAS specification 1.4
The low level header class. Header is built from a laspy.util.Format instance, or assumes a default file format of 1.2. Header is usually interacted with via the HeaderManager class, an instance of which readers, writers, and file objects retain a reference of.
The laspy.util.Format instance of the header, builds and stores specifications for the data fields belonging to the header. Assigning to format will re-format the header.
HeaderManager provides the public API for interacting with header objects. It requires a Header instance and a reader/writer instance. HeaderManager instances are referred to in reader/writer/file object code as header.
Returns the number of user-defined header records in the header.
The offset to the point data in the file. This can not be smaller then the header size + VLR length.
The length of each point record.
The header’s date from a datetime.datetime instance.
Parameters: | value – datetime.datetime instance or none to use the current time |
---|
>>> t = datetime.datetime(2008,3,19)
>>> hdr.date = t
>>> hdr.date
datetime.datetime(2008, 3, 19, 0, 0)
Note
LAS files do not support storing full datetimes in their headers, only the year and the day number. The conversion is handled for you if you use datetime.datetime instances, however.
The file signature for the file. Should always be LASF
The file source ID for the file.
Global encoding for the file.
From the specification:
This is a bit field used to indicate certain global properties about the file. In LAS 1.2 (the version in which this field was introduced), only the low bit is defined (this is the bit, that if set, would have
The header size for the file. You probably shouldn’t touch this.
The maximum values of [x, y, z] for the data in the file.
The major version for the file, always 1
The minimum values of [x, y, z] for the data in the file.
>>> hdr.min
[0.0, 0.0, 0.0]
>>> hdr.min = [33452344.2333, 523442.344, -90.993]
>>> hdr.min
[33452344.2333, 523442.34399999998, -90.992999999999995]
The minor version for the file.
The offset factors in [x, y, z] for the point data.
>>> hdr.offset
[0.0, 0.0, 0.0]
>>> hdr.offset = [32, 32, 256]
>>> hdr.offset
[32.0, 32.0, 256.0]
The number of bytes between the end of the VLRs and the beginning of the point data.
ProjectID for the file. laspy does not currently support setting this value from Python, as it is the same as laspy.header.Header.guid. Use that to manipulate the ProjectID for the file.
The histogram of point records by return number.
The header format for the file. Supports .xml and .etree methods.
The software ID for the file
The system ID for the file
The version as a dotted string for the file (ie, ‘1.0’, ‘1.1’, etc)
Get/set the VLR`’s for the header as a list VLR’s are completely overwritten, so to append a VLR, first retreive the existing list with get_vlrs and append to it.
An object to create/read/store data from LAS Variable Length Records. Requires three arguments: (user_id, string[16]), (record_id, int2), (VLR_body, any data with len < ~65k)