# readers.rdb

The RDB reader reads from files in the RDB format, the in-house format used by RIEGL Laser Measurement Systems GmbH.

Dynamic Plugin

This stage requires a dynamic plugin to operate

Streamable Stage

This stage supports streaming operations

## Installation

To build PDAL with rdb support, `set rdb_DIR` to the path of your local rdblib installation. rdblib can be obtained from the RIEGL download pages with a properly enabled user account. The rdblib files do not need to be in a system-level directory, though they could be (e.g. they could be in `/usr/local`, or just in your home directory somewhere). For help building PDAL with optional libraries, see the optional library documentation.

Note

- Minimum rdblib version required to build the driver and run the tests: 2.1.6

- This driver was developed and tested on Ubuntu 17.10 using GCC 7.2.0.

## Example

This example pipeline reads points from a RDB file and stores them in LAS format. Only points classified as “ground points” are read since option `filter` is set to “riegl.class == 2” (see line 5).

     1[
     2    {
     3        "type": "readers.rdb",
     4        "filename": "autzen-thin-srs.rdbx",
     5        "filter": "riegl.class == 2"
     6    },
     7    {
     8        "type": "writers.las",
     9        "filename": "autzen-thin-srs.rdbx"
    10    }
    11]

## Options

filename

  Name of file to read [Required]

count

  Maximum number of points to read. [Default: unlimited]

override_srs

  Spatial reference to apply to the data. Overrides any SRS in the input itself. Can be specified as a WKT, proj.4 or EPSG string. Can’t use with ‘default_srs’ [Default: none]

default_srs

  Spatial reference to apply to the data if the input does not specify one. Can be specified as a WKT, proj.4 or EPSG string. Can’t use with ‘override_srs’ [Default: none]

filter

  Point filter expression string (see RDB SDK documentation for details) [Optional] [Default: empty string (= no filter)]

extras

  Read all available dimensions (true) or known PDAL dimensions only (false) [Optional] [Default: false]

## Dimensions

The reader maps following default RDB point attributes to PDAL dimensions (if they exist in the RDB file):

RDB attribute | PDAL dimension(s)
--- | ---
riegl.id | Id::PointId
riegl.source_cloud_id | Id::OriginId
riegl.timestamp | Id::InternalTime
riegl.xyz | Id::X, Id::Y, Id::Z
riegl.intensity | Id::Intensity
riegl.amplitude | Id::Amplitude
riegl.reflectance | Id::Reflectance
riegl.deviation | Id::Deviation
riegl.pulse_width | Id::PulseWidth
riegl.background_radiation | Id::BackgroundRadiation
riegl.target_index | Id::ReturnNumber
riegl.target_count | Id::NumberOfReturns
riegl.scan_direction | Id::ScanDirectionFlag
riegl.scan_angle | Id::ScanAngleRank
riegl.class | Id::Classification
riegl.rgba | Id::Red, Id::Green, Id::Blue
riegl.surface_normal | Id::NormalX, Id::NormalY, Id::NormalZ

All other point attributes that may exist in the RDB file are ignored unless the option `extras` is set to true. If so, a custom dimension is defined for each additional point attribute, whereas the dimension name is equal to the point attribute name.

Note

Point attributes are read “as-is”, no scaling or unit conversion is done by the reader. The only exceptions are point coordinates (`riegl.xyz`) and surface normals (`riegl.surface_normal`) which are transformed to the RDB file’s SRS by applying the matrix defined in the (optional) RDB file metadata object `riegl.geo_tag`.

## Metadata

The reader adds following objects to the stage’s metadata node:

### Object “database”

Contains basic information about the RDB file such as the bounding box, number of points and the file ID.

Example:

     1 {
     2   "bounds": {
     3     "maximum": {
     4       "X": -2504493.762,
     5       "Y": -3846841.252,
     6       "Z":  4413210.394
     7     },
     8     "minimum": {
     9       "X": -2505882.459,
    10       "Y": -3848231.393,
    11       "Z":  4412172.548
    12     }
    13   },
    14   "points": 10653,
    15   "uuid": "637de54d-7e6b-4004-b6ab-b6bc588ec9ea"
    16 }

### List “dimensions”

List of point attribute description objects.

Example:

     1 [{
     2   "compression_options": "shuffle",
     3   "default_value": 0,
     4   "description": "Cartesian point coordinates wrt. application coordinate system (0: X, 1: Y, 2: Z)",
     5   "invalid_value": "",
     6   "length": 3,
     7   "maximum_value": 535000,
     8   "minimum_value": -535000,
     9   "name": "riegl.xyz",
    10   "resolution": 0.00025,
    11   "scale_factor": 1,
    12   "storage_class": "variable",
    13   "title": "XYZ",
    14   "unit_symbol": "m"
    15 },
    16 {
    17   "compression_options": "shuffle",
    18   "default_value": 0,
    19   "description": "Target surface reflectance",
    20   "invalid_value": "",
    21   "length": 1,
    22   "maximum_value": 327.67,
    23   "minimum_value": -327.68,
    24   "name": "riegl.reflectance",
    25   "resolution": 0.01,
    26   "scale_factor": 1,
    27   "storage_class": "variable",
    28   "title": "Reflectance",
    29   "unit_symbol": "dB"
    30 }]

Details about the point attribute properties see RDB SDK documentation.

### Object “metadata”

Contains one sub-object for each metadata object stored in the RDB file.

Example:

     1 {
     2   "riegl.scan_pattern": {
     3     "rectangular": {
     4       "phi_start": 45.0,
     5       "phi_stop": 270.0,
     6       "phi_increment": 0.040,
     7       "theta_start": 30.0,
     8       "theta_stop": 130.0,
     9       "theta_increment": 0.040,
    10       "program": {
    11         "name": "High Speed"
    12       }
    13     }
    14   },
    15   "riegl.geo_tag": {
    16     "crs": {
    17       "epsg": 4956,
    18       "wkt": "GEOCCS[\"NAD83(HARN) \/ Geocentric\",DATUM[\"NAD83(HARN)\",SPHEROID[\"GRS 1980\",6378137.000,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6152\"]],PRIMEM[\"Greenwich\",0.0000000000000000,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"Meter\",1.00000000000000000000,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"X\",OTHER],AXIS[\"Y\",EAST],AXIS[\"Z\",NORTH],AUTHORITY[\"EPSG\",\"4956\"]]"
    19     },
    20     "pose": [
    21        0.837957447, 0.379440385, -0.392240121, -2505819.156,
    22       -0.545735575, 0.582617132, -0.602270669, -3847595.645,
    23        0.000000000, 0.718736580,  0.695282481,  4412064.882,
    24        0.000000000, 0.000000000,  0.000000000,        1.000
    25     ]
    26   }
    27 }

The `riegl.geo_tag` object defines the Spatial Reference System (SRS) of the file. The point coordinates are actually stored in a local coordinate system (usually horizontally leveled) which is based on the SRS. The transformation from the local system to the SRS is defined by the 4x4 matrix `pose` which is stored in row-wise order. Point coordinates (`riegl.xyz`) and surface normals (`riegl.surface_normal`) are automatically transformed to the SRS by the reader.

Details about the metadata objects see RDB SDK documentation.

### List “transactions”

List of transaction objects describing the history of the file.

Example:

     1 [{
     2   "agent": "RDB Library 2.1.6-1677 (x86_64-windows, Apr  5 2018, 10:58:39)",
     3   "comments": "",
     4   "id": 1,
     5   "rdb": "RDB Library 2.1.6-1677 (x86_64-windows, Apr  5 2018, 10:58:39)",
     6   "settings": {
     7     "cache_size": 524288000,
     8     "chunk_size": 65536,
     9     "chunk_size_lod": 20,
    10     "compression_level": 10,
    11     "primary_attribute": {
    12       "compression_options": "shuffle",
    13       "default_value": 0,
    14       "description": "Cartesian point coordinates wrt. application coordinate system (0: X, 1: Y, 2: Z)",
    15       "invalid_value": "",
    16       "length": 3,
    17       "maximum_value": 535000,
    18       "minimum_value": -535000,
    19       "name": "riegl.xyz",
    20       "resolution": 0.00025,
    21       "scale_factor": 1,
    22       "storage_class": "variable",
    23       "title": "XYZ",
    24       "unit_symbol": "m"
    25     }
    26   },
    27   "start": "2018-04-06 10:10:39.336",
    28   "stop": "2018-04-06 10:10:39.336",
    29   "title": "Database creation"
    30 },
    31 {
    32   "agent": "rdbconvert",
    33   "comments": "",
    34   "id": 2,
    35   "rdb": "RDB Library 2.1.6-1677 (x86_64-windows, Apr  5 2018, 10:58:39)",
    36   "settings": "",
    37   "start": "2018-04-06 10:10:39.339",
    38   "stop": "2018-04-06 10:10:39.380",
    39   "title": "Import"
    40 },
    41 {
    42   "agent": "RiSCAN PRO 64 bit v2.6.3",
    43   "comments": "",
    44   "id": 3,
    45   "rdb": "RDB Library 2.1.6-1677 (x86_64-windows, Apr  5 2018, 10:58:39)",
    46   "settings": "",
    47   "start": "2018-04-06 10:10:41.666",
    48   "stop": "2018-04-06 10:10:41.666",
    49   "title": "Meta data saved"
    50 }]

Details about the transaction objects see RDB SDK documentation.