laspy.laswriter module
LasWriter
- class laspy.laswriter.LasWriter(dest: BinaryIO, header: LasHeader, do_compress: bool | None = None, laz_backend: LazBackend | Iterable[LazBackend] | None = None, closefd: bool = True, encoding_errors: str = 'strict')[source]
Bases:
objectAllows to write a complete LAS/LAZ file to the destination.
- __init__(dest: BinaryIO, header: LasHeader, do_compress: bool | None = None, laz_backend: LazBackend | Iterable[LazBackend] | None = 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 the points type is PackedPointRecord, then you need to make sure the points are expressed in the same scales and offsets ‘system’ than this writer.
You can use
LasData.change_scaling()before getting the points to ensure that.If the points type is ScaleAwarePointsRecord, then points will automatically re-scaled.
- 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.
- write_evlrs(evlrs: VLRList) None[source]
Writes the EVLRs to the file
- Parameters:
evlrs (VLRList) – The EVLRs to be written
- Raises:
LaspyException – If the file’s version is not >= 1.4