mt_to_terra | R Documentation |
Convert tidy MODISTools data to a terra SpatRaster for easy spatial processing and plotting.
mt_to_terra(df, reproject = FALSE, method = "bilinear")
df |
a valid MODISTools data frame with a single band (filter for a
particular band using the dplyr |
reproject |
reproject output to lat / long (default = |
method |
character. Method used for estimating the new cell values of a SpatRaster. One of: near: nearest neighbor. This method is fast, and it can be the preferred method if the cell values represent classes. It is not a good choice for continuous values. This is used by default if the first layer of x is categorical. bilinear: bilinear interpolation. This is the default if the first layer of x is numeric (not categorical). cubic: cubic interpolation. cubicspline: cubic spline interpolation. |
A terra SpatRaster populated with the tidy dataframe values
mt_subset
mt_batch_subset
# list all available MODIS Land Products Subsets products
# download data
LC <- mt_subset(product = "MCD12Q1",
lat = 48.383662,
lon = 2.610250,
band = "LC_Type1",
start = "2005-01-01",
end = "2005-12-30",
km_lr = 2,
km_ab = 2,
site_name = "testsite",
internal = TRUE,
progress = FALSE)
head(LC)
# convert to raster
LC_r <- mt_to_terra(df = LC)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.