Main Content


Read variable length record from LAS or LAZ file



vlr = readVLR(lasReader,recordID) reads the variable length record vlr from the specified record recordID of the LAS or LAZ file reader lasReader.


collapse all

Create a lasFileReader object for a LAZ file. Then, use the readVLR function to read variable length record (VLR) data from the LAZ file.

Create a lasFileReader object to access the LAZ file data.

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

Read VLR data from the LAZ file using the readVLR function.

vlr = readVLR(lasReader,2112);

Display the VLR data.

       RecordID: 2112
         UserID: 'liblas'
    Description: 'OGR variant of OpenGIS WKT SRS'
           Data: 'COMPD_CS["NAD83 / UTM zone 16N + VERT_CS",PROJCS["NAD83 / UTM zone 16N",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-87],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],AUTHORITY["EPSG","26916"],AXIS["Easting",EAST],AXIS["Northing",NORTH]],VERT_CS["NAVD88 height",VERT_DATUM["North American Vertical Datum 1988",2005,AUTHORITY["EPSG","5103"],EXTENSION["PROJ4_GRIDS","g2003conus.gtx,g2003alaska.gtx,g2003h01.gtx,g2003p01.gtx"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Up",UP],AUTHORITY["EPSG","5703"]]]'

Input Arguments

collapse all

LAS or LAZ file reader, specified as a lasFileReader object.

Record ID, specified as a positive integer.

Output Arguments

collapse all

Variable length record, returned as a structure. The structure contains these fields:

  • RecordID — Record ID of the VLR, returned as a positive integer.

  • UserID — User ID that created the VLR, returned as a string scalar.

  • Description — Text description of the VLR, returned as a string scalar.

The structure also contains the VLR data, either as raw byte values or in a form determined by the record ID of the VLR, in one of these fields. For more information on the VLR header, or the various types of records, see the ASPRS LASER (LAS) File Format Exchange Activities page.

  • RawByteData — Raw bytes of data stored in the VLR, returned as an integer vector. The length of the vector is equal to the Record Length After Header value in the corresponding VLR header.

  • Data — Parsed data for standard VLR records. The value of this field depends on the contents of the VLR and corresponds to its record ID. These are the values for the record IDs that return a Data field:

    Record IDDescription

    Data of the Classification Lookup record, returned as a character vector or string scalar.


    ASCII data of the Text Area Description record, returned as a character vector or string scalar.


    Data of the Waveform Packet Descriptor record, returned as a structure containing these fields:

    • BitsPerSample — Number of bits for each sample in the range 2 to 32 bits.

    • CompressionType — Compression algorithm for waveform packets. Value 0 represents no compression. Reserved for future use.

    • NumberOfSamples — Number of samples in decompressed waveform packet.

    • TemporalSpacing — Temporal sample spacing in picoseconds.

    • DigitizerGain — Digitizer gain to use to convert raw digitized value to an absolute digitizer voltage.

    • DigitizerOffset — Digitizer offset to use to convert raw digitized value to an absolute digitizer voltage.


    ASCII data of the OGS Math Transform WKT record, returned as a character vector or string scalar.


    ASCII data of the OGS Coordinate System WKT record, returned as a character vector or string scalar.


    GeoTiff key values of the GeoKeyDirectoryTag record, returned as a structure containing these fields:

    • KeyDirectoryVersion — Key directory version number, returned as 1.

    • KeyRevision — Key revision number, returned as 1.

    • MinorRevision — Minor revision number, returned as 0.

    • NumberOfKeys — Number of keys, returned as a scalar.

    • KeyEntries — Structure for each key containing these fields:

      • KeyID — Key ID for each GeoTIFF data.

      • TIFFTagLocation — Location of the data for the specified key ID.

      • Count — Number of characters in GeoAsciiParamsTag string value. Otherwise it returns 1.

      • ValueOffset — Value depends on the TIFFTagLocation field.

    34736Data of the GeoDoubleParamsTag record, returned as a numeric vector of type double.
    34737ASCII data of the GeoAsciiParamsTag record, returned as a character vector or string scalar.

Data Types: struct

Version History

Introduced in R2022a