Util¶
The laspy util module holds useful data structures and functions needed in multiple locations, but not belonging unambiguously to File, Reader/Writer, or Header
- class laspy.util.Format(fmt, overwritable=False, extra_bytes=False, extradims=[])[source]¶
A Format instance consists of a set of
laspy.util.Spec
objects, as well as some calculated attributes and summary methods. For example, Format builds the pt_fmt_long attribute, which provides astruct
compatible format string to pack and unpack an entire formatted object (laspy.util.Point
in particular) in its entirety. Format additionally supports thelaspy.util.Format.xml
andlaspy.util.Format.etree
methods for interrogating the members of a format. This can be useful in finding out what dimensions are available from a given point format, among other things.- __init__(fmt, overwritable=False, extra_bytes=False, extradims=[])[source]¶
Build the
laspy.util.Format
instance.
- etree()[source]¶
Return an XML etree object, describing all of the
laspy.util.Spec
objects belonging to the Format.
- xml()[source]¶
Return an XML Formatted string, describing all of the
laspy.util.Spec
objects belonging to the Format.
- class laspy.util.Point(reader, bytestr=False, unpacked_list=False, nice=False)[source]¶
A data structure for reading and storing point data. The latest version of laspy’s api does not use the Point class’ reading capabilities, and it is important to note that reading and writing points does not require a list of point instances. See
laspy.file.points
for more details- make_nice()[source]¶
Turn a point instance with the bare essentials (an unpacked list of data) into a fully populated point. Add all the named attributes it possesses, including binary fields.
- pack()[source]¶
Return a binary string representing the point data. Slower than
numpy.array.tostring
, which is used bylaspy.base.DataProvider
.
- class laspy.util.Spec(name, offs, fmt, num, pack=False, ltl_endian=True, overwritable=True, idx=False)[source]¶
Holds information about how to read and write a particular field. These are usually created by
laspy.util.Format
objects.