pylas.lasdata module

LasData

class pylas.lasdata.LasData(header: pylas.header.LasHeader, points: Optional[pylas.point.record.PackedPointRecord] = None)[source]

Bases: object

Class synchronizing all the moving parts of LAS files.

It connects the point record, header, vlrs together.

To access points dimensions using this class you have two possibilities

las = pylas.read('some_file.las')
las.classification
# or
las['classification']
x

Returns the scaled x positions of the points as doubles

y

Returns the scaled y positions of the points as doubles

z

Returns the scaled z positions of the points as doubles

point_format

Shortcut to get the point format

points

Returns the point record

vlrs
add_extra_dim(params: pylas.point.format.ExtraBytesParams) → None[source]

Adds a new extra dimension to the point record

Note

If you plan on adding multiple extra dimensions, prefer add_extra_dims() as it will save re-allocations and data copy

Parameters:params (ExtraBytesParams) – parameters of the new extra dimension to add
add_extra_dims(params: List[pylas.point.format.ExtraBytesParams]) → None[source]

Add multiple extra dimensions at once

Parameters:params (list of parameters of the new extra dimensions to add) –
update_header() → None[source]

Update the information stored in the header to be in sync with the actual data.

This method is called automatically when you save a file using pylas.lasdatas.base.LasBase.write()

write(destination, do_compress=None, laz_backend=None)[source]

Writes to a stream or file

Note

When destination is a string, it will be interpreted as the path were the file should be written to, and whether the file will be compressed depends on the extension used (case insensitive):

  • .laz -> compressed
  • .las -> uncompressed

And the do_compress option will be ignored

Parameters:
  • destination (str or file object) – filename or stream to write to
  • do_compress (bool, optional) – Flags to indicate if you want to compress the data
  • laz_backend (optional, the laz backend to use) – By default, pylas detect available backends
change_scaling(scales=None, offsets=None) → None[source]