Learn R Programming

lidR (version 1.4.2)

catalog_queries: Extract LiDAR data based on a set of coordinates

Description

From a set of (x, y) coordinates corresponding to the centers of regions of interest (ROIs), for example a ground inventory, the function automatically extracts the lidar data associated with the ROIs from a catalog. The algorithm will do this even for ROIs falling on the edges of one or more tiles. The extracted lidar data can be buffered. In this case the function adds a buffer area around the ROIs, and the LAS object returned has an extra column named 'buffer' which indicates, for each point, if the point is in the buffer or from the ROI (see more in the section Buffer). lidR support .lax file. You will speed-up the computation a lot with a spatial index.

Usage

catalog_queries(obj, x, y, r, r2 = NULL, buffer = 0, roinames = NULL, ...)

Arguments

obj

A LAScatalog object

x

vector. A set of x coordinates corresponding to the centers of the ROIs

y

vector. A set of y coordinates corresponding to the centers of the ROIs

r

numeric or vector. A radius or a set of radii of the ROIs. If only r is provided (r2 = NULL) it will extract data falling onto a disc.

r2

numeric or vector. A radius or a set of radii of plots. If r2 is provided, the selection turns into a rectangular ROI (if r = r2 it is a square).

buffer

numeric. Adds a buffer area around the ROI. See relevant sections.

roinames

vector. A set of ROI names (the plot IDs, for example) to label the returned list.

...

Any argument available in readLAS to reduce the amount of data loaded.

Value

A list of LAS objects

Buffer

If the ROIs are buffered then the LAS objects returned by the function have extra points. The LAS objects received by the user contain a special column called 'buffer', which indicates, for each point, if it comes from a buffered area or not. Points from non-buffered areas (i.e. the ROI) have a 'buffer' value of 0, while those from buffered areas have a 'buffer' value greater than 0. For a circular ROI, points in the buffered area have a buffer value of 1. For a rectangular ROI the points in the buffer area have a buffer value of 1, 2, 3 or 4, where 1 is the bottom buffer and 2, 3 and 4 are the left, top and right buffers, respectively.

Multicore computation

The process is done using several cores. To change the settings of how a catalog is processed use catalog_options.

See Also

readLAS catalog catalog_options

Examples

Run this code
# NOT RUN {
# Build a LAScatalog
catalog = catalog("<Path to a folder containing a set of .las or .laz files>")

# Get coordinates from an external file
X = runif(30, 690000, 800000)
Y = runif(30, 5010000, 5020000)
R = 25

# Return a List of 30 circular LAS objects of 25 m radius
catalog %>% catalog_queries(X, Y, R)

# Return a List of 30 square LAS objects of 50x50 m
catalog %>% catalog_queries(X, Y, R, R)

# Return a List of 30 circular LAS objects of 30 m radius. 25 m being the ROI and 5 m
# being a buffered area. The LAS objects have an extra column called 'buffer' to
# differentiate the points.
catalog %>% catalog_queries(X, Y, R, buffer = 5)

# Return a List of 30 circular LAS objects of 25 m radius for which only the fields X, Y and
# Z have been loaded and Z values < 0 were removed.
catalog %>% catalog_queries(X, Y, R, XYZonly = TRUE, filter = "-drop_z_below 0")
# }

Run the code above in your browser using DataLab