View source: R/terra-raster-utils.R
genericExtract | R Documentation |
Extracts points from raster layers using the original raster layer projection.
genericExtract(x, y, field = NULL, ...)
x |
a raster or polygon object ( |
y |
a points or polygons spatial object ( |
field |
character. The field(s) to extract when x is a polygon.
If |
... |
passed to |
If x
and y
are both polygons, extract
often outputs NA
due to misalignments
(this can happen even when x == y
), even after snap(y, x)
.
To circumvent this problem, intersect
is used internally and,
if the extract
argument fun
is passed, it is applied to values of y
per polygon ID of x
.
a data.table
with extracted values and an ID
column of y point IDs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.