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


The name of the extra dimension


The type of the extra dimension


A description of the extra dimension


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


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)
>>> dim = fmt.dimension_by_name("classification") # or fmt["classification"]
>>> dim.max
>>> dim.min
>>> dim.num_bits
property standard_dimensions: Iterable[DimensionInfo]

Returns an iterable of the standard dimensions

>>> fmt = PointFormat(0)
>>> standard_dims = list(fmt.standard_dimensions)
>>> len(standard_dims)
>>> standard_dims[4].name
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
>>> fmt = PointFormat(3)
>>> fmt.add_extra_dimension(ExtraBytesParams("codification", "uint64"))
>>> fmt.size
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
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
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')
>>> == 'number_of_returns'
>>> info.num_bits == 3
>>> 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]

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


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