- class laspy.header.LasHeader(*, version: Optional[Union[Version, str]] = None, point_format: Optional[Union[PointFormat, int]] = None)¶
Contains the information from the header of as LAS file with ‘implementation’ field left out and ‘users’ field stored in more ergonomic classes.
This header also contains the VLRs
Creating a default header:
>>> header = LasHeader() >>> header <LasHeader(1.2, <PointFormat(3, 0 bytes of extra dims)>)>
Creating a header with the wanted version and point format:
>>> header = LasHeader(version=Version(1, 4), point_format=PointFormat(6)) >>> header <LasHeader(1.4, <PointFormat(6, 0 bytes of extra dims)>)>
>>> header = LasHeader(version="1.4", point_format=6) >>> header <LasHeader(1.4, <PointFormat(6, 0 bytes of extra dims)>)>
- DEFAULT_VERSION = Version(major=1, minor=2)¶
The default version used when None is given to init
- DEFAULT_POINT_FORMAT = <PointFormat(3, 0 bytes of extra dims)>¶
The default point format Used when None is given to init
- generating_software: Union[str, bytes]¶
The software which generated the file Initialized to ‘laspy’
- scales: ndarray¶
The numbers used to scale the x,y,z coordinates
- offsets: ndarray¶
The numbers used to offset the x,y,z coordinates
- number_of_points_by_return: ndarray¶
Number of points by return for las <= 1.2 only the first 5 elements matters
- evlrs: Optional[VLRList]¶
EVLRs, even though they are not stored in the ‘header’ part of the file we keep them in this class as they contain same information as vlr. None when the file does not support EVLR
- property version: Version¶
- add_crs(crs: pyproj.CRS, keep_compatibility: bool = True) None ¶
Add a Coordinate Reference System VLR from a pyproj CRS object.
The type of VLR created depends on the las version and point format version. Las version >= 1.4 use WKT string, las version < 1.4 and point format < 6 use GeoTiff tags.
This requires pyproj.
Not all CRS are supported when adding GeoTiff tags. For example, custom CRS.
Typically, if the CRS has an EPSG code it will be supported.
- parse_crs() Optional[pyproj.CRS] ¶
Method to parse OGC WKT or GeoTiff VLR keys into a pyproj CRS object
This requires pyproj.
Reads EVLRs from the stream and sets them in the data property.
The evlrs are accessed from the evlrs property
- Does nothing if either of these is true:
The file does not support EVLRS (version < 1.4)
The file has no EVLRS
The stream does not support seeking
Leaves/restores the stream position to where it was before the call