Interactive Square ROI Clipping with lidR
Source:R/clip_square_interactive.R
clip_square_interactive.Rd
Interactively clips a square ROI from a LAS dataset. It first builds a canopy height model and displays it. Then the user clicks the centre of the square. A square polygon is constructed and used to clip the LAS dataset.
Usage
clip_square_interactive(
las,
width = 100,
res = 1,
subcircle = 0,
return_type = c("las", "both", "polygon")
)
Arguments
- las
A character string (path to a LAS/LAZ) or a LAS object.
- width
Numeric. Side length of the square ROI (same units as CRS). Default: 100.
- res
Numeric. Resolution (in same units) for rasterizing the CHM. Default: 1.
- subcircle
Numeric.
p2r
subcircle for canopy rasterization. Default: 0.- return_type
Character. What to return: "las" (default), "both", or "polygon".
"las": return the clipped LAS object (original behavior)
"polygon": return only the square ROI sf polygon (sfc POLYGON)
"both": return a named list with
list(las = <LAS>, roi = <sfc POLYGON>)
Value
Depending on return_type
:
"las": a LAS object containing only the points within the square ROI
"polygon": an
sf
sfc
POLYGON of the selected ROI"both": a named list with elements
las
androi
Examples
if (FALSE) { # \dontrun{
# Example using the Megaplot dataset
lasFile <- system.file("extdata", "Megaplot.laz", package = "lidR")
las_clip <- clip_square_interactive(
las = lasFile,
width = 15,
res = 1,
subcircle = 0.1,
return_type = "las"
)
} # }