# lidarPointAttributes

## Description

The `lidarPointAttributes`

object stores additional point
attributes that are not stored in a `pointCloud`

object. These attributes are
associated to lidar data.

## Creation

Use either `lidarPointAttributes`

function or the
`readPointCloud`

function to create a
`lidarPointAttributes`

object. The `readPointCloud`

function also creates a `pointCloud`

object.

To create a `lidarPointAttributes`

object using
`readPointCloud`

function, see the Read Attributes from LAS File example.

### Description

creates a `attr`

= lidarPointAttributes(`Name=Value`

)`lidarPointAttributes`

object with properties set using one or
more name-value arguments.

## Properties

`Count`

— Number of available point records in file

nonnegative integer

This property is read-only.

Number of available point records in the file, specified as a nonnegative integer.

`Classification`

— Classification numbers

`[]`

(default) | *M*-by-1 vector of nonnegative integers

Classification numbers of each point, specified as an *M*-by-1
vector of nonnegative integers. *M* is equal to the number of available
point records.

For LAS file point data record formats 0 to 5, the classification number ranges from 0 to 31.

Classification Number | Classification Type |
---|---|

`0` | Created, never classified |

`1` | Unclassified |

`2` | Ground |

`3` | Low vegetation |

`4` | Medium vegetation |

`5` | High vegetation |

`6` | Building |

`7` | Low point (noise) |

`8` | Model key-point |

`9` | Water |

`10` | Reserved |

`11` | Reserved |

`12` | Overlap points |

`13` - `31` | Reserved |

For LAS file point data record formats 6 to 10, the classification number ranges from 0 to 255.

Classification Number | Classification Type |
---|---|

`0` | Created, never classified |

`1` | Unclassified |

`2` | Ground |

`3` | Low vegetation |

`4` | Medium vegetation |

`5` | High vegetation |

`6` | Building |

`7` | Low point (noise) |

`8` | Reserved |

`9` | Water |

`10` | Rail |

`11` | Road surface |

`12` | Reserved |

`13` | Wire guard (shield) |

`14` | Wire conductor (phase) |

`15` | Transmission tower |

`16` | Wire-structure connector (insulator) |

`17` | Bridge deck |

`18` | High noise |

`19`
| Overhead structure |

`20` | Ignored ground |

`21` | Snow |

`22` | Temporal exclusion |

`23` - `63` | Reserved |

`64` - `255` | User-defined |

These are standard class names and class-object mappings. The class definition and mapping might differ depending on the application that created the LAS or LAZ file.

**Example: **`Classification`

=`[0 255 128]'`

specifies
the classification numbers for three points as 0, 255, and 128.

**Data Types: **`uint8`

`LaserReturn`

— Laser pulse return numbers

`[]`

(default) | *M*-by-1 vector of positive integers

Laser pulse return numbers of each point, specified as an *M*-by-1
vector of positive integers. *M* is equal to the number of available
point records.

For LAS file point data record formats 0 to 5, the values are in the range 1 to 5, and for point data record formats 6 to 10, the values are in the range 1 to 15.

**Example: **`LaserReturn`

=`[10 15 1]'`

specifies the
laser pulse return numbers for three points as 10, 15, and 1.

**Data Types: **`uint8`

`NumReturns`

— Total number of returns

`[]`

(default) | *M*-by-1 vector of positive integers

Total number of returns for a pulse, specified as an *M*-by-1
vector of positive integers. *M* is equal to the number of available
point records.

For LAS file point data record formats 0 to 5, the values are in the range 1 to 5, and for point data record formats 6 to 10, the values are in the range 1 to 15.

**Example: **`NumReturns`

=`[1 10 15]'`

specifies the
total number of returns for three points as 1, 10, and 15.

**Data Types: **`uint8`

`GPSTimeStamp`

— GPS time stamps

`[]`

(default) | *M*-by-1 `duration`

vector

GPS time stamps of each point, specified as an *M*-by-1 `duration`

vector in seconds. *M* is equal to the number of
available point records.

**Example: **`GPSTimeStamp`

=`seconds(1:3)'`

specifies
the GPS time stamps for three points as 1, 2, and 3 seconds.

`NearIR`

— Near infrared channel value

`[]`

(default) | *M*-by-1 vector of positive integers

Near infrared channel value of each point, specified as an *M*-by-1
vector of positive integers. *M* is equal to the number of available
point records. Values must be in the range [0, 65535].

**Example: **`NearIR`

=`ones(3,1)`

specifies the near
infrared channel values for three points as `1`

.

**Data Types: **`uint16`

`ScanAngle`

— Scan angle

`[]`

(default) | *M*-by-1 vector

Scan angle of each point, specified as an *M*-by-1 vector. Each
value represents the rotational angle at which the point is captured in the laser
system. The angle is negative to the left of the front of the sensor, positive to the
right, and 0 degrees directly in front. *M* is equal to the number of
available point records.

For LAS file point data record formats 0 to 5, the values are in the range –90 to 90, and for point data record formats 6 to 10, the value ranges from –180 to 180.

**Example: **`ScanAngle`

=`[0 -180 105]'`

specifies the
scan angles for three points as directly ahead, 180 degrees to the left, and 105 degrees
to the right.

**Data Types: **`single`

`PointSourceID`

— Point source ID

`[]`

(default) | *M*-by-1 vector of nonnegative integers

Point source ID of each point, specified as an *M*-by-1 vector of
nonnegative integers. Each element defines the source from which a point originates.
*M* is equal to the number of available point records.

A source is a grouping of temporally consistent data, such as a flight line for aerial systems. The values are in the range [0, 65535].

**Example: **`PointSourceID`

=`[0 1 65535]'`

specifies
the point source IDs for three points as 0, 1, and 65535.

**Data Types: **`uint16`

`ScannerChannel`

— Scanner channel

`[]`

(default) | *M*-by-1 vector of nonnegative integers

Scanner channel of each point, specified as an *M*-by-1 vector of
nonnegative integers. *M* is equal to the number of available point
records.

For single channel systems the value is `0`

. The values are in the
range [0, 3].

**Example: **`ScannerChannel`

=`[0 0 0]'`

specifies the
scanner channels for three points as `0`

.

**Data Types: **`uint8`

`ScanDirectionFlag`

— Scan direction flag

`[]`

(default) | *M*-by-1 logical vector

Scan direction flag of each point, specified as an *M*-by-1 logical
vector. *M* is equal to the number of available point records.

The value specifies the direction of scanner mirror motion during the capture of the
corresponding point. Left-to-right motion is defined as positive, while right-to-left
motion is defined as negative. A logical `1`

(`true`

)
denotes a positive scan direction for the point, and a logical `0`

(`false`

) denotes a negative scan direction.

**Example: **`ScanDirectionFlag`

=`false(3,1)`

specifies
the scan direction flags for three points as right-to-left.

**Data Types: **`logical`

`EdgeOfFlightLineFlag`

— Edge of flight line flag

`[]`

(default) | *M*-by-1 logical vector

Edge of flight line flag of each point, specified as an *M*-by-1
logical vector. *M* is equal to the number of available point
records.

Logical `1`

(`true`

) indicates that the point lies
on the edge of the flight line. Otherwise, the corresponding element is a logical
`0`

(`false`

).

**Example: **`EdgeOfFlightLineFlag`

=`true(3,1)`

specifies that three points lie on the edge of the flight line.

**Data Types: **`logical`

`ClassificationFlags`

— Classification flags

empty structure (default) | structure

Classification flags, specified as a structure. The structure contains these fields:

`Synthetic`

— An*M*-by-1 logical vector, where logical`1`

(`true`

) indicates that the point was generated synthetically. Otherwise, the point is specified as logical`0`

(`false`

).`Keypoint`

— An*M*-by-1 logical vector, where`true`

indicates that the point is a model key-point. Otherwise, the point is specified as`false`

.`Withheld`

— An*M*-by-1 logical vector, where`true`

indicates that the point is withheld from the processing algorithm. Otherwise, the point is specified as`false`

.`Overlap`

— An*M*-by-1 logical vector, where`true`

indicates that the point lies within the overlap region of two or more swaths. Otherwise, the point is specified as`false`

.

**Example: **`ClassificationFlags`

=`struct(Synthetic=true(3,1),Keypoint=false(3,1),Withheld=true(3,1),Overlap=false(3,1))`

specifies the classification flags for three points as a structure.

`WaveformData`

— Waveform data

empty structure (default) | structure

Waveform data, specified as a structure. The waveform data is stored in point records and the corresponding variable length records of a LAS or LAZ file. The structure contains these fields:

Field | Value | Description |
---|---|---|

`WavePacketDescriptorIndex` | M-by-1 vector of type `double` | If this value is greater than zero, then the corresponding point has waveform information in the VLR record indicated by the value of this field + 99. When this value is zero, the point has no waveform data. |

`ByteOffsetToWaveformPacketData` | M-by-1 vector of type `double` | Defines the location of the waveform packet of a particular point within the stored waveform data. This data is present in an extended variable length record (EVLR) or an auxiliary WPD file. |

`WaveformPacketSize` | M-by-1 vector of type `double` | Defines the size of waveform packet in bytes. This value is present in an extended variable length record (EVLR) or an auxiliary WPD file. |

`ReturnPointLocation` | M-by-1 vector of type `double` | Each element represents the offset from the first digitized value to the location within the waveform packet at which the associated return pulse was detected. These values are represented in picoseconds. |

`Xt` | M-by-1 vector of type `double` | Defines the X component of parametric line equation. For more information, see Parametric line equation. |

`Yt` | M-by-1 vector of type `double` | Defines the Y component of parametric line equation. For more information, see Parametric line equation. |

`Zt` | M-by-1 vector of type `double` | Defines the Z component of parametric line equation. For more information, see Parametric line equation. |

`BitsPerSample` | M-by-1 vector of type `double` | Number of bits for each sample in the range 2 to 32 bits. |

`CompressionType` | M-by-1 vector of type `double` | Compression algorithm for waveform packets. Value 0 represents no compression. Reserved for future use. |

`NumberOfSamples` | M-by-1 vector of type `double` | Defines the number of samples in decompressed waveform packet. |

`TemporalSpacing` | M-by-1 vector of type `double` | Defines the temporal sample spacing in picoseconds. |

`DigitizerGain` | M-by-1 vector of type `double` | Defines the digitizer gain to use to convert raw digitized value to an absolute digitizer voltage. |

`DigitizerOffset` | M-by-1 vector of type `double` | Defines the digitizer offset to use to convert raw digitized value to an absolute digitizer voltage. |

This example specifies the waveform data for three points as a structure.

WaveformData = struct(WavePacketDescriptorIndex=[2011 2200 3215]', ... ByteOffsetToWaveformPacketData=[51 65 78]', ... WaveformPacketSize=[12 28 25]', ... ReturnPointLocation=[1 2 3]', ... Xt=[1 2 3]',Yt=[3 4 5]',Zt=[5 6 7]', ... BitsPerSample=[1 2 3]', ... CompressionType=[1 0 1]', ... NumberOfSamples=[10 25 32]', ... TemporalSpacing=[11 21 31]', ... DigitizerGain=[11 12 13]', ... DigitizerOffset=[21 22 23]')

`UserData`

— User data

`[]`

(default) | *M*-by-1 vector of integers

User data, specified as an *M*-by-1 vector of integers.
*M* is equal to the number of available point records. This value
corresponds to the user data field of the point record data in the LAS file. Use this
field at your discretion.

**Example: **`UserData`

=`[1 2 4]'`

specifies the user
data for three points.

## Examples

### Read Attributes from LAS File

Create a `lasFileReader`

object for a LAS file. Then, use the `readPointCloud`

function to read attributes from the LAS file and generate a `lidarPointAttributes`

object.

Create a `lasFileReader`

object to access the LAS file data.

path = fullfile(toolboxdir("lidar"),"lidardata", ... "las","aerialLidarData2.las"); lasReader = lasFileReader(path);

Read all points and point attributes from the LAS file to a `pointCloud`

object and `lidarPointAttributes`

object, respectively, by using the `readPointCloud`

function.

[ptCloud,pointAttributes] = readPointCloud(lasReader,Attributes= ... ["Classification","LaserReturn","NumReturns", ... "EdgeOfFlightLine","ScanAngle"]);

Display the point attributes.

disp(pointAttributes)

lidarPointAttributes with properties: Count: 78970 Classification: [78970x1 uint8] LaserReturn: [78970x1 uint8] NumReturns: [78970x1 uint8] GPSTimeStamp: [0x0 duration] NearIR: [] ScanAngle: [78970x1 single] PointSourceID: [] ScannerChannel: [] ScanDirectionFlag: [] EdgeOfFlightLineFlag: [78970x1 logical] ClassificationFlags: [1x1 struct] WaveformData: [1x1 struct] UserData: []

### Create `lidarPointAttributes `

Object

Specify attributes of the `lidarPointAttributes`

object for three points.

classificationValues=[0 255 128]'; laserReturns=[10 15 1]'; numReturns=[1 10 15]';

Create a `lidarPointAttributes`

object.

```
attr=lidarPointAttributes(Classification=classificationValues, ...
LaserReturn=laserReturns,NumReturns=numReturns);
```

Display the point attributes.

disp(attr)

lidarPointAttributes with properties: Count: 3 Classification: [3x1 uint8] LaserReturn: [3x1 uint8] NumReturns: [3x1 uint8] GPSTimeStamp: [0x0 duration] NearIR: [] ScanAngle: [] PointSourceID: [] ScannerChannel: [] ScanDirectionFlag: [] EdgeOfFlightLineFlag: [] ClassificationFlags: [1x1 struct] WaveformData: [1x1 struct] UserData: []

## Algorithms

The values of `Xt`

, `Yt`

, and `Zt`

fields in `WaveformData`

property define a parametric line equation for
extrapolating points along the associated waveform. The position along the wave is given by:

$$\begin{array}{l}X={X}_{0}+{X}_{t}\\ Y={Y}_{0}+{Y}_{t}\\ Z={Z}_{0}+{Z}_{t}\end{array}$$

where X, Y, and Z represent the spatial position of the derived point,
X_{0}, Y_{0}, and Z_{0} define
the position of the anchor point, X_{t}, Y_{t}, and
Z_{t} define the position of the point at a distance of time
*t*, in picoseconds, relative to the anchor point. The X, Y, and Z units
are identical to the units of the coordinate system of the LAS data. If the coordinate system
is geographic, the horizontal units are decimal degrees and the vertical units are in
meters.

The fields `Xt`

, `Yt`

, and `Zt`

have
been renamed to `dx`

, `dy`

, and `dz`

in
latest LAS file specification. For more information, see the ASPRS LASER (LAS) File Format Exchange Activities page.

## Version History

**Introduced in R2022a**

### R2022b: `WaveformData`

property has additional fields

The structure for the `WaveformData`

property has these additional fields.

`WavePacketDescriptorIndex`

`ByteOffsetToWaveformPacketData`

`WaveformPacketSize`

### R2022b: `WaveformData`

structure fields are updated

The order of fields in the `WaveformData`

structure has been updated
to:

WavePacketDescriptorIndex: [] ByteOffsetToWaveformPacketData: [] WaveformPacketSize: [] ReturnPointLocation: [] Xt: [] Yt: [] Zt: [] BitsPerSample: [] CompressionType: [] NumberOfSamples: [] TemporalSpacing: [] DigitizerGain: [] DigitizerOffset: []

Prior to R2022b, the order was:

Xt: [] Yt: [] Zt: [] ReturnPointLocation: [] BitsPerSample: [] CompressionType: [] NumberOfSamples: [] TemporalSpacing: [] DigitizerGain: [] DigitizerOffset: []

## See Also

### Functions

### Objects

## MATLAB 命令

您点击的链接对应于以下 MATLAB 命令：

请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)