l4_clip | R Documentation |
Useful to get GEDI data for a specific study area, by clipping the data to a vector boundary or extent. Remember that, by default GEDI coordinates are in lon/lat format (EPSG 4326).
l4_clip(gediL4, clip, usegeometry = NULL, tct = NULL)
gediL4 |
|
clip |
An object from which an extent can be obtained (xmin, xmax, ymin,
ymax). Currently could be a path to a shp or tif file, an object of class
|
usegeometry |
Logical: should the points be clipped on the boundary of
a vector geometry (or path from which a geometry can be
created). NULL and FALSE will be interpreted as the same, in that case the
extent of |
tct |
Numeric: tree cover threshold to filter GEDI data. |
GEDI coordinates are by default in lon/lat format (EPSG 4326). The
function will try to convert the extent of clip
to lon/lat
coordinate system to ensure compatibility during the clip. The only
exeption is when clip
is a numeric vector or an extent object. In these
cases the user must check that the extent is in lon/lat
projection.
A data.table
object if usegeometry=NULL
or FALSE
,
a SpatVector
otherwise. It return NULL
if gediL4
is
NULL
.
outdir = tempdir()
l4_zip <- system.file("extdata",
"GEDI04_A_2020036151358_O06515_02_T00198_02_002_01_V002.zip",
package="GEDI4R")
l4 <- unzip(l4_zip,exdir = outdir)
#get GEDI data
l4_data <- l4_getmulti(l4)
#clip using vector of coordinates
b_box <- c(-50,35,52,37)
clipped <- l4_clip(l4_data,clip=b_box)
#using Shapefile to clip
bound <- system.file("extdata","bound4326.shp",package="GEDI4R")
#with extension
clipped <- l4_clip(l4_data,clip=bound,usegeometry = F)
#with polygon boundaries
clipped2 <- l4_clip(l4_data,clip=bound,usegeometry = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.