# laspy.vlrs.known module

The definition of the VLR Header, VLR, the KnownVLRs are in this module.

A KnownVLR is a VLR for which we know how to parse its record_data

class laspy.vlrs.known.IKnownVLR

  Bases: `ABC`

  Interface that any KnownVLR must implement. A KnownVLR is a VLR for which we know how to parse its record_data

  Implementing this interfaces allows to automatically call the right parser for the right VLR when reading them.

  abstract static official_user_id() → str

    Shall return the official user_id as described in the documentation

  abstract static official_record_ids() → Tuple[int, ...]

    Shall return the official record_id for the VLR

    Note

    Even if the VLR has one record_id, the return type must be a tuple

    Returns:

      The record_ids this VLR type can have

    Return type:

      tuple of int

  abstract record_data_bytes() → bytes

    Shall return the bytes corresponding to the record_data part of the VLR as they should be written in the file.

    Returns:

      The bytes of the vlr’s record_data

    Return type:

      bytes

  abstract parse_record_data(record_data: bytes) → None

    Shall parse the given record_data into a user-friendlier structure

    Parameters:

      record_data (bytes) – The record_data bytes read from the file

class laspy.vlrs.known.BaseKnownVLR(record_id=None, description='')

  Bases: `BaseVLR`, `IKnownVLR`, `ABC`

  Base Class to factorize common code between the different type of Known VLRs

  classmethod from_raw(raw: VLR)

class laspy.vlrs.known.ClassificationLookupVlr

  Bases: `BaseKnownVLR`

  This vlr maps class numbers to short descriptions / names

      >>> lookup = ClassificationLookupVlr()
      >>> lookup[0] = "never_classified"
      >>> lookup[2] = "ground"
      >>> lookup[0]
      'never_classified'

  parse_record_data(record_data: bytes) → None

    Shall parse the given record_data into a user-friendlier structure

    Parameters:

      record_data (bytes) – The record_data bytes read from the file

  record_data_bytes() → bytes

    Shall return the bytes corresponding to the record_data part of the VLR as they should be written in the file.

    Returns:

      The bytes of the vlr’s record_data

    Return type:

      bytes

  static official_user_id() → str

    Shall return the official user_id as described in the documentation

  static official_record_ids() → Tuple[int, ...]

    Shall return the official record_id for the VLR

    Note

    Even if the VLR has one record_id, the return type must be a tuple

    Returns:

      The record_ids this VLR type can have

    Return type:

      tuple of int

class laspy.vlrs.known.LasZipVlr(data: bytes)

  Bases: `BaseKnownVLR`

  Contains the information needed by laszip (or any other laz backend) to compress the point records.

  parse_record_data(record_data: bytes) → None

    Shall parse the given record_data into a user-friendlier structure

    Parameters:

      record_data (bytes) – The record_data bytes read from the file

  record_data_bytes() → bytes

    Shall return the bytes corresponding to the record_data part of the VLR as they should be written in the file.

    Returns:

      The bytes of the vlr’s record_data

    Return type:

      bytes

  static official_user_id() → str

    Shall return the official user_id as described in the documentation

  static official_record_ids() → Tuple[int, ...]

    Shall return the official record_id for the VLR

    Note

    Even if the VLR has one record_id, the return type must be a tuple

    Returns:

      The record_ids this VLR type can have

    Return type:

      tuple of int

  classmethod from_raw(raw_vlr)

class laspy.vlrs.known.ExtraBytesStruct

  Bases: `Structure`

  NO_DATA_BIT_MASK = 1
  MIN_BIT_MASK = 2
  MAX_BIT_MASK = 4
  SCALE_BIT_MASK = 8
  OFFSET_BIT_MASK = 16
  property no_data
  property min
  property max
  property offset: Any | None
  property scale
  format_name()
  dtype() → dtype
  num_elements() → int
  static size()
  data_type

    Structure/Union member

  description

    Structure/Union member

  name

    Structure/Union member

  options

    Structure/Union member

  reserved

    Structure/Union member

  unused

    Structure/Union member

class laspy.vlrs.known.ExtraBytesVlr

  Bases: `BaseKnownVLR`

  parse_record_data(data)

    Shall parse the given record_data into a user-friendlier structure

    Parameters:

      record_data (bytes) – The record_data bytes read from the file

  record_data_bytes()

    Shall return the bytes corresponding to the record_data part of the VLR as they should be written in the file.

    Returns:

      The bytes of the vlr’s record_data

    Return type:

      bytes

  type_of_extra_dims() → List[ExtraBytesParams]
  static official_user_id()

    Shall return the official user_id as described in the documentation

  static official_record_ids()

    Shall return the official record_id for the VLR

    Note

    Even if the VLR has one record_id, the return type must be a tuple

    Returns:

      The record_ids this VLR type can have

    Return type:

      tuple of int

class laspy.vlrs.known.WaveformPacketStruct

  Bases: `Structure`

  static size()
  bits_per_sample

    Structure/Union member

  digitizer_gain

    Structure/Union member

  digitizer_offset

    Structure/Union member

  number_of_samples

    Structure/Union member

  temporal_sample_spacing

    Structure/Union member

  waveform_compression_type

    Structure/Union member

class laspy.vlrs.known.WaveformPacketVlr(record_id, description='')

  Bases: `BaseKnownVLR`

  parse_record_data(record_data)

    Shall parse the given record_data into a user-friendlier structure

    Parameters:

      record_data (bytes) – The record_data bytes read from the file

  record_data_bytes()

    Shall return the bytes corresponding to the record_data part of the VLR as they should be written in the file.

    Returns:

      The bytes of the vlr’s record_data

    Return type:

      bytes

  static official_record_ids()

    Shall return the official record_id for the VLR

    Note

    Even if the VLR has one record_id, the return type must be a tuple

    Returns:

      The record_ids this VLR type can have

    Return type:

      tuple of int

  static official_user_id()

    Shall return the official user_id as described in the documentation

  classmethod from_raw(raw_vlr)

class laspy.vlrs.known.GeoKeyEntryStruct

  Bases: `Structure`

  static size()
  count

    Structure/Union member

  id

    Structure/Union member

  tiff_tag_location

    Structure/Union member

  value_offset

    Structure/Union member

class laspy.vlrs.known.GeoKeysHeaderStructs

  Bases: `Structure`

  static size()
  key_directory_version

    Structure/Union member

  key_revision

    Structure/Union member

  minor_revision

    Structure/Union member

  number_of_keys

    Structure/Union member

class laspy.vlrs.known.GeoKeyDirectoryVlr

  Bases: `BaseKnownVLR`

  parse_record_data(record_data)

    Shall parse the given record_data into a user-friendlier structure

    Parameters:

      record_data (bytes) – The record_data bytes read from the file

  record_data_bytes()

    Shall return the bytes corresponding to the record_data part of the VLR as they should be written in the file.

    Returns:

      The bytes of the vlr’s record_data

    Return type:

      bytes

  parse_crs()
  static official_user_id()

    Shall return the official user_id as described in the documentation

  static official_record_ids()

    Shall return the official record_id for the VLR

    Note

    Even if the VLR has one record_id, the return type must be a tuple

    Returns:

      The record_ids this VLR type can have

    Return type:

      tuple of int

class laspy.vlrs.known.GeoDoubleParamsVlr

  Bases: `BaseKnownVLR`

  Stores all of the double valued GeoKeys.

  parse_record_data(record_data)

    Shall parse the given record_data into a user-friendlier structure

    Parameters:

      record_data (bytes) – The record_data bytes read from the file

  record_data_bytes()

    Shall return the bytes corresponding to the record_data part of the VLR as they should be written in the file.

    Returns:

      The bytes of the vlr’s record_data

    Return type:

      bytes

  static official_user_id()

    Shall return the official user_id as described in the documentation

  static official_record_ids()

    Shall return the official record_id for the VLR

    Note

    Even if the VLR has one record_id, the return type must be a tuple

    Returns:

      The record_ids this VLR type can have

    Return type:

      tuple of int

class laspy.vlrs.known.GeoAsciiParamsVlr

  Bases: `BaseKnownVLR`

  Stores all of the ASCII valued GeoKeys.

  From GeoTIFF’s spec: To avoid problems with naive tiff dump programs the separator between geokeys is not the null-terminator ` but `|.

  parse_record_data(record_data)

    Shall parse the given record_data into a user-friendlier structure

    Parameters:

      record_data (bytes) – The record_data bytes read from the file

  record_data_bytes()

    Shall return the bytes corresponding to the record_data part of the VLR as they should be written in the file.

    Returns:

      The bytes of the vlr’s record_data

    Return type:

      bytes

  static official_user_id()

    Shall return the official user_id as described in the documentation

  static official_record_ids()

    Shall return the official record_id for the VLR

    Note

    Even if the VLR has one record_id, the return type must be a tuple

    Returns:

      The record_ids this VLR type can have

    Return type:

      tuple of int

class laspy.vlrs.known.WktMathTransformVlr

  Bases: `BaseKnownVLR`

  From the Spec:

    Note that the math transform WKT record is added for completeness, and a coordinate system WKT may or may not require a math transform WKT record

  parse_record_data(record_data)

    Shall parse the given record_data into a user-friendlier structure

    Parameters:

      record_data (bytes) – The record_data bytes read from the file

  record_data_bytes()

    Shall return the bytes corresponding to the record_data part of the VLR as they should be written in the file.

    Returns:

      The bytes of the vlr’s record_data

    Return type:

      bytes

  static official_user_id()

    Shall return the official user_id as described in the documentation

  static official_record_ids()

    Shall return the official record_id for the VLR

    Note

    Even if the VLR has one record_id, the return type must be a tuple

    Returns:

      The record_ids this VLR type can have

    Return type:

      tuple of int

class laspy.vlrs.known.WktCoordinateSystemVlr(wkt_string='')

  Bases: `BaseKnownVLR`

  Replaces Coordinates Reference System for new las files (point fmt >= 5) “LAS is not using the “ESRI WKT”

  parse_record_data(record_data)

    Shall parse the given record_data into a user-friendlier structure

    Parameters:

      record_data (bytes) – The record_data bytes read from the file

  record_data_bytes()

    Shall return the bytes corresponding to the record_data part of the VLR as they should be written in the file.

    Returns:

      The bytes of the vlr’s record_data

    Return type:

      bytes

  parse_crs()
  static official_user_id()

    Shall return the official user_id as described in the documentation

  static official_record_ids()

    Shall return the official record_id for the VLR

    Note

    Even if the VLR has one record_id, the return type must be a tuple

    Returns:

      The record_ids this VLR type can have

    Return type:

      tuple of int

laspy.vlrs.known.vlr_factory(vlr: VLR)

  Given a vlr tries to find its corresponding KnownVLR class that can parse its data. If no KnownVLR implementation is found, returns the input vlr unchanged