# laspy.lasreader module

## LasReader

class laspy.lasreader.LasReader(source: BinaryIO, closefd: bool = True, laz_backend: LazBackend | Iterable[LazBackend] | None = None, read_evlrs: bool = True, decompression_selection: DecompressionSelection = <DecompressionSelection.XY_RETURNS_CHANNEL|Z|CLASSIFICATION|FLAGS|INTENSITY|SCAN_ANGLE|USER_DATA|POINT_SOURCE_ID|GPS_TIME|RGB|NIR|WAVEPACKET|ALL_EXTRA_BYTES: 8191>)

  Bases: `object`

  The reader class handles LAS and LAZ via one of the supported backend

  __init__(source: BinaryIO, closefd: bool = True, laz_backend: LazBackend | Iterable[LazBackend] | None = None, read_evlrs: bool = True, decompression_selection: DecompressionSelection = <DecompressionSelection.XY_RETURNS_CHANNEL|Z|CLASSIFICATION|FLAGS|INTENSITY|SCAN_ANGLE|USER_DATA|POINT_SOURCE_ID|GPS_TIME|RGB|NIR|WAVEPACKET|ALL_EXTRA_BYTES: 8191>)

    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

      - decompression_selection (optional, DecompressionSelection) – Selection of fields to decompress, only works form point format >= 6 <= 10 Ignored on other point formats

      - versionadded: (..) – 2.4: The `read_evlrs` and `decompression_selection` parameters.

  property evlrs: VLRList | None
  property point_source: IPointReader
  read_points(n: int) → ScaleAwarePointRecord

    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

    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

    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

  chunk_iterator(points_per_iteration: int) → PointChunkIterator

    Returns an iterator, that will read points by chunks of the requested size

    Parameters:

      points_per_iteration – number of points to be read with each iteration

    Returns:

  read_evlrs()
  close() → None

    closes the file object used by the reader