pylas.lasdatas module

class pylas.lasdatas.base.LasBase(*, header, vlrs=None, points=None)[source]

Bases: object

LasBase is the base of all the different LasData classes. These classes are objects that the user will interact with to manipulate las data.

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']

Note

using las[‘dimension_name’] is not possible with the scaled values of x, y, z

add_extra_dim(name, type, description='')[source]

Adds a new extra dimension to the point record

Parameters:
  • name (str) – the name of the dimension
  • type (str) – type of the dimension (eg ‘uint8’)
  • description (str, optional) – a small description of the dimension
point_format
points

returns the numpy array representing the points

Returns:
Return type:the Numpy structured array of points
update_header()[source]
write(destination, do_compress=None)[source]

Writes to a stream or file

When destination is a string, it will be interpreted as the path were the file should be written to, also if do_compress is None, the compression will be guessed from the file extension:

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

Note

This means that you could do something like:

# Create .laz but not compressed

las.write(‘out.laz’, do_compress=False)

# Create .las but compressed

las.write(‘out.las’, do_compress=True)

While it should not confuse Las/Laz readers, it will confuse humans so avoid doing it

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
write_to(out_stream, do_compress=False)[source]

writes the data to a stream

Parameters:
  • out_stream (file object) – the destination stream, implementing the write method
  • do_compress (bool, optional, default False) – Flag to indicate if you want the date to be compressed
write_to_file(filename, do_compress=None)[source]

Writes the las data into a file

Parameters:
  • filename (str) – The file where the data should be written.
  • do_compress (bool, optional, default None) – if None the extension of the filename will be used to determine if the data should be compressed otherwise the do_compress flag indicate if the data should be compressed
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

pylas.lasdatas.base.is_in_bounds_of_type(array, type_info)[source]
pylas.lasdatas.base.scale_dimension(array_dim, scale, offset)[source]
pylas.lasdatas.base.unscale_dimension(array_dim, scale, offset)[source]