laspy.point.format module

class laspy.point.format.ExtraBytesParams(name: str, type: Union[str, dtype, Type[uint8]], description: str = '', offsets: Optional[Iterable[Union[number, float, int]]] = None, scales: Optional[Iterable[Union[number, float, int]]] = None)[source]

Bases: object

All parameters needed to create extra bytes

name

The name of the extra dimension

type

The type of the extra dimension

description

A description of the extra dimension

offsets

The offsets to use if its a ‘scaled dimension’, can be none

scales

The scales to use if its a ‘scaled dimension’, can be none

class laspy.point.format.PointFormat(point_format_id: int)[source]

Bases: object

Class that contains the informations about the dimensions that forms a PointFormat.

A PointFormat has ‘standard’ dimensions (dimensions defined in the LAS standard, each point format has its set of dimensions), but it can also have extra (non-standard) dimensions defined by the user)

>>> fmt = PointFormat(3)
>>> all(dim.is_standard for dim in fmt.dimensions)
True
>>> dim = fmt.dimension_by_name("classification") # or fmt["classification"]
>>> dim.max
31
>>> dim.min
0
>>> dim.num_bits
5
property standard_dimensions: Iterable[DimensionInfo]

Returns an iterable of the standard dimensions

>>> fmt = PointFormat(0)
>>> standard_dims = list(fmt.standard_dimensions)
>>> len(standard_dims)
15
>>> standard_dims[4].name
'return_number'
property extra_dimensions: Iterable[DimensionInfo]
property dimension_names: Iterable[str]

Returns the names of the dimensions contained in the point format

property standard_dimension_names: Iterable[str]

Returns the names of the extra dimensions in this point format

property extra_dimension_names: Iterable[str]

Returns the names of the extra dimensions in this point format

property size: int

Returns the number of bytes (standard + extra) a point takes

>>> PointFormat(3).size
34
>>> fmt = PointFormat(3)
>>> fmt.add_extra_dimension(ExtraBytesParams("codification", "uint64"))
>>> fmt.size
42
property num_standard_bytes: int

Returns the number of bytes used by standard dims

>>> fmt = PointFormat(3)
>>> fmt.add_extra_dimension(ExtraBytesParams("codification", "uint64"))
>>> fmt.num_standard_bytes
34
property num_extra_bytes: int

Returns the number of extra bytes

>>> fmt = PointFormat(3)
>>> fmt.add_extra_dimension(ExtraBytesParams("codification", "uint64"))
>>> fmt.num_extra_bytes
8
property has_waveform_packet

Returns True if the point format has waveform packet dimensions

dimension_by_name(name: str) DimensionInfo[source]

Returns the dimension info for the dimension by name

ValueError is raised if the dimension does not exist un the point format

>>> info = PointFormat(2).dimension_by_name('number_of_returns')
>>> info.name == 'number_of_returns'
True
>>> info.num_bits == 3
True
>>> info = PointFormat(2).dimension_by_name('gps_time')
Traceback (most recent call last):
...
ValueError: Dimension 'gps_time' does not exist
add_extra_dimension(param: ExtraBytesParams) None[source]

Add an extra, user-defined dimension

remove_extra_dimension(name: str) None[source]
dtype()[source]

Returns the numpy.dtype used to store the point records in a numpy array

Note

The dtype corresponds to the dtype with sub_fields packed into their composed fields

laspy.point.format.lost_dimensions(point_fmt_in, point_fmt_out)[source]

Returns a list of the names of the dimensions that will be lost when converting from point_fmt_in to point_fmt_out