laspy.laswriter module¶
LasWriter¶
- class laspy.laswriter.LasWriter(dest: BinaryIO, header: LasHeader, do_compress: Optional[bool] = None, laz_backend: Optional[Union[LazBackend, Iterable[LazBackend]]] = None, closefd: bool = True, encoding_errors: str = 'strict')[source]¶
Bases:
object
Allows to write a complete LAS/LAZ file to the destination.
- __init__(dest: BinaryIO, header: LasHeader, do_compress: Optional[bool] = None, laz_backend: Optional[Union[LazBackend, Iterable[LazBackend]]] = None, closefd: bool = True, encoding_errors: str = 'strict') None [source]¶
- Parameters:
dest (file_object) – file object where the LAS/LAZ will be written
header (LasHeader) – The header of the file to be written
do_compress (bool, optional) – Whether the file data should be written as LAS (uncompressed) or LAZ (compressed). If None, the file won’t be compressed, unless a laz_backend is provided
laz_backend (LazBackend or list of LazBackend, optional) – The LazBackend to use (or if it is a sequence the LazBackend to try) for the compression
closefd (bool, default True) – should the dest be closed when the writer is closed
encoding_errors (str, default 'strict') – How encoding errors should be treated. Possible values and their explanation can be seen here: https://docs.python.org/3/library/codecs.html#error-handlers.
- write_points(points: PackedPointRecord) None [source]¶
Note
If you are writing points coming from multiple different input files into one output file, you have to make sure the point record you write all use the same scales and offset of the writer.
You can use
LasData.change_scaling()
orScaleAwarePointRecord.change_scaling()
to do that.- Parameters:
points (PackedPointRecord or ScaleAwarePointRecord) – The points to be written
- Raises:
LaspyException – If the point format of the points does not match the point format of the writer.