# tf\_point\_cloud\_metadata

Returns metadata for one or more `las` or `laz` point cloud/LiDAR files from a local file or directory source, optionally constraining the bounding box for metadata retrieved to the lon/lat bounding box specified by the `x_min`, `x_max`, `y_min`, `y_max` arguments.

Note: specified path must be contained in global `allowed-import-paths`, otherwise an error will be returned.

```
SELECT * FROM TABLE(
    tf_point_cloud_metadata(
        path => <path>,
        [x_min => <x_min>,
        x_max => <x_max>,
        y_min => <y_min>,
        y_max => <y_max>]
    )
)
```

**Input Arguments**

| Parameter          | Description                                                                                                                        | Data Types         |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| `path`             | The path of the file or directory containing the las/laz file or files. Can contain globs. Path must be in `allowed-import-paths`. | TEXT ENCODING NONE |
| `x_min` (optional) | Min x-coordinate value for point cloud files to retrieve metadata from.                                                            | DOUBLE             |
| `x_max` (optional) | Max x-coordinate value for point cloud files to retrieve metadata from.                                                            | DOUBLE             |
| `y_min` (optional) | Min y-coordinate value for point cloud files to retrieve metadata from.                                                            | DOUBLE             |
| `y_max` (optional) | Max y-coordinate value for point cloud files to retrieve metadata from.                                                            | DOUBLE             |

**Output Columns**

| Name                  | Description                                           | Data Types                  |
| --------------------- | ----------------------------------------------------- | --------------------------- |
| `file_path`           | Full path for the las or laz file                     | Column\<TEXT ENCODING DICT> |
| `file_name`           | Filename for the las or laz file                      | Column\<TEXT ENCODING DICT> |
| `file_source_id`      | File source id per file metadata                      | Column\<SMALLINT>           |
| `version_major`       | LAS version major number                              | Column\<SMALLINT>           |
| `version_minor`       | LAS version minor number                              | Column\<SMALLINT>           |
| `creation_year`       | Data creation year                                    | Column\<SMALLINT>           |
| `is_compressed`       | Whether data is compressed, i.e. LAZ format           | Column\<BOOLEAN>            |
| `num_points`          | Number of points in this file                         | Column\<BIGINT>             |
| `num_dims`            | Number of data dimensions for this file               | Column\<SMALLINT>           |
| `point_len`           | Not currently used                                    | Column\<SMALLINT>           |
| `has_time`            | Whether data has time value                           | COLUMN\<BOOLEAN>            |
| `has_color`           | Whether data contains rgb color value                 | COLUMN\<BOOLEAN>            |
| `has_wave`            | Whether data contains wave info                       | COLUMN\<BOOLEAN>            |
| `has_infrared`        | Whether data contains infrared value                  | COLUMN\<BOOLEAN>            |
| `has_14_point_format` | Data adheres to 14-attribute standard                 | COLUMN\<BOOLEAN>            |
| `specified_utm_zone`  | UTM zone of data                                      | Column\<INT>                |
| `x_min_source`        | Minimum x-coordinate in source projection             | Column\<DOUBLE>             |
| `x_max_source`        | Maximum x-coordinate in source projection             | Column\<DOUBLE>             |
| `y_min_source`        | Minimum y-coordinate in source projection             | Column\<DOUBLE>             |
| `y_max_source`        | Maximum y-coordinate in source projection             | Column\<DOUBLE>             |
| `z_min_source`        | Minimum z-coordinate in source projection             | Column\<DOUBLE>             |
| `z_max_source`        | Maximum z-coordinate in source projection             | Column\<DOUBLE>             |
| `x_min_4326`          | Minimum x-coordinate in lon/lat degrees               | Column\<DOUBLE>             |
| `x_max_4326`          | Maximum x-coordinate in lon/lat degrees               | Column\<DOUBLE>             |
| `y_min_4326`          | Minimum y-coordinate in lon/lat degrees               | Column\<DOUBLE>             |
| `y_max_4326`          | Maximum y-coordinate in lon/lat degrees               | Column\<DOUBLE>             |
| `z_min_4326`          | Minimum z-coordinate in meters above sea level (AMSL) | Column\<DOUBLE>             |
| `z_max_4326`          | Maximum z-coordinate in meters above sea level (AMSL) | Column\<DOUBLE>             |

**Example**

```
SELECT
  file_name,
  num_points,
  specified_utm_zone,
  x_min_4326,
  x_max_4326,
  y_min_4326,
  y_max_4326
FROM
  TABLE(
    tf_point_cloud_metadata(
      path => '/home/todd/data/lidar/las_files/*2010_00000*.las'
    )
  )
ORDER BY
  file_name;
  
file_name|num_points|specified_utm_zone|x_min_4326|x_max_4326|y_min_4326|y_max_4326
ARRA-CA_GoldenGate_2010_000001.las|2063102|10|-122.9943066785969|-122.9772226614453|37.97913478250298|37.99265200734278
ARRA-CA_GoldenGate_2010_000002.las|4755131|10|-122.9943056338411|-122.9772184796481|37.99265416515848|38.00617135784082
ARRA-CA_GoldenGate_2010_000003.las|4833631|10|-122.9943045883859|-122.9772142950517|38.00617351665583|38.01969067717678
ARRA-CA_GoldenGate_2010_000004.las|6518715|10|-122.9943035422309|-122.9772101076538|38.01969283699149|38.03320996534712
ARRA-CA_GoldenGate_2010_000005.las|7508919|10|-122.9943024953755|-122.9772059174526|38.03321212616189|38.04672922234828
ARRA-CA_GoldenGate_2010_000006.las|7442130|10|-122.9943014478193|-122.977201724446|38.04673138416345|38.06024844817669
ARRA-CA_GoldenGate_2010_000007.las|5610772|10|-122.9943003995618|-122.9771975286321|38.06025061099263|38.07376764282882
ARRA-CA_GoldenGate_2010_000008.las|3515095|10|-122.9942993506024|-122.9771933300088|38.07376980664591|38.08728680630115
ARRA-CA_GoldenGate_2010_000009.las|1689283|10|-122.9942898783015|-122.9771554156435|38.19544116402802|38.20895787388029
```
