get_las_bounds: Get bounds from the header of a LAS file or object

View source: R/tile_functions.R

get_las_boundsR Documentation

Get bounds from the header of a LAS file or object

Description

This function reads the bounding coordinates and projection information from the header of either a LAS file on disk (either compressed or uncompressed) or LAS object imported via prepare_tile. The bounds are returned as either: a named vector, an EWKT (Extended Well Known Text) string specifier, an sf package bounding box, an sf package geometry list object or a terra package SpatExtent object.

Usage

get_las_bounds(
  x,
  type = c("vec", "wkt", "sfc", "bbox", "terra"),
  unzip.dir = NULL
)

Arguments

x

Either a character string specifying the path to a file, or a LAS object (e.g. imported using function prepare_tile). If a path, the file can be an uncompressed tile (.las), a compressed tile (.laz) or a zip file containing a .las file.

type

Either 'vec' (default) to return a named vector of min and max coordinates and EPSG code; 'wkt' to return an EWKT text string, 'sfc' to return an sf package geometry list with a polygon, 'bbox' to return an sf package bounding box object, or 'terra' to return a 'terra' package 'SpatExtent' object.

unzip.dir

The directory in which to uncompress a compressed LAS file (identified by a '.zip' extension). If NULL (default) a temporary directory will be used. After processing, the uncompressed file will be deleted. Ignored if x is a LAS object or the path to a LAS or LAZ file.

Value

The bounding polygon in the format specified by the type argument.

Examples

## Not run: 
# Read bounds from a zipped LAS file and return as a vector
bounds <- get_las_bounds("c:/somewhere/myfile.zip")

# Get bounds as an 'sf' bounding box
bounds <- get_las_bounds("c:/somewhere/myfile.zip", type = "sf")
print(bounds)
plot(bounds)

# Same thing for an imported LAS object
las <- prepare_tile("c:/somewhere/myfile.zip")
bounds <- get_las_bounds(las, type = "sf")

## End(Not run)


mbedward/CERMBlidar documentation built on April 10, 2024, 2:05 p.m.