View source: R/left_join_raster.R
left_join_raster | R Documentation |
left_join_raster
tests if a point is within a raster object and returns
the raster's object value if TRUE
. This process is analogous to a SQL
left join but with a raster object. In raster applications, this is also
called an extraction or location process.
left_join_raster(
df,
latitude = "latitude",
longitude = "longitude",
projection = "+proj=longlat +datum=WGS84 +no_defs",
raster,
name = "raster_value"
)
df |
Data frame containing latitude and longitude (or other coordinate pair) variables. |
latitude |
|
longitude |
|
projection |
|
raster |
A raster object to be joined to |
name |
The name of |
Points to be tested are generally stored in a data frame with latitude and
longitude pairs (or any other projection system) and the raster object must
have the same projection system. The result is the input data frame, with
the joined raster values. Observations which do not match are filled with
NA
.
Currently only one layer is used with no buffer. No interpolation or aggregation functions are used either.
raster::extract
is used for the join.
Stuart K. Grange
## Not run:
# Get ozone concentrations from a raster object
data_select <- left_join_raster(data_select, raster = raster_ozone,
name = "ozone")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.