laspy.lasreader module¶
LasReader¶
- class laspy.lasreader.LasReader(source: BinaryIO, closefd: bool = True, laz_backend: Optional[Union[LazBackend, Iterable[LazBackend]]] = None, read_evlrs: bool = True)[source]¶
Bases:
object
The reader class handles LAS and LAZ via one of the supported backend
- __init__(source: BinaryIO, closefd: bool = True, laz_backend: Optional[Union[LazBackend, Iterable[LazBackend]]] = None, read_evlrs: bool = True)[source]¶
Initialize the LasReader
- Parameters:
source (file_object) –
closefd (bool, default True) –
laz_backend (LazBackend or list of LazBackend, optional) –
read_evlrs (bool, default True) – only applies to __init__ phase, and for files that support evlrs
- property point_source: IPointReader¶
- read_points(n: int) ScaleAwarePointRecord [source]¶
Read n points from the file
Will only read as many points as the header advertise. That is, if you ask to read 50 points and there are only 45 points left this function will only read 45 points.
If there are no points left to read, returns an empty point record.
- Parameters:
n (The number of points to read) – if n is less than 0, this function will read the remaining points
- read() LasData [source]¶
Reads all the points that are not read and returns a LasData object
This will also read EVLRS
- seek(pos: int, whence: int = 0) int [source]¶
Seeks to the start of the point at the given pos
- Parameters:
pos (index of the point to seek to) –
whence (optional, controls how the pos parameter is interpreted:) – io.SEEK_SET: (default) pos is the index of the point from the beginning io.SEEK_CUR: pos is the point_index relative to the point_index of the last point read io.SEEK_END: pos is the point_index relative to last point
- Return type:
The index of the point the reader seeked to, relative to the first point