getRaster | R Documentation |
getRaster
downloads publicly available MAP rasters for a specific surface & year, clipped to a provided bounding box or shapefile.
getRaster(
dataset_id = NULL,
surface = NULL,
shp = NULL,
extent = NULL,
file_path = NULL,
year = NULL,
vector_year = NULL
)
dataset_id |
A character string specifying the dataset ID(s) of one or more rasters. These dataset ids can be found in the data.frame returned by listRaster, in the dataset_id column e.g. c('Malaria__202206_Global_Pf_Mortality_Count', 'Malaria__202206_Global_Pf_Parasite_Rate') |
surface |
deprecated argument. Please remove it from your code. |
shp |
SpatialPolygon(s) object of a shapefile to use when clipping downloaded rasters. (use either |
extent |
2x2 matrix specifying the spatial extent within which raster data is desired, as returned by sf::st_bbox() - the first column has the minimum, the second the maximum values; rows 1 & 2 represent the x & y dimensions respectively (matrix(c("xmin", "ymin","xmax", "ymax"), nrow = 2, ncol = 2, dimnames = list(c("x", "y"), c("min", "max")))) (use either |
file_path |
string specifying the directory to which raster files will be downloaded, if you want to download them. If none given, rasters will not be saved to files. |
year |
default = |
vector_year |
deprecated argument. Please remove it from your code. |
getRaster
returns a SpatRaster for the specified extent. Or a SpatRasterCollection if the two rasters are incompatible in terms of projection/extent/resolution
autoplot_MAPraster
to quickly visualise rasters downloded using getRaster
.
as.MAPraster
to convert RasterLayer/RasterStack objects into a 'MAPraster' object (data.frame) for easy plotting with ggplot.
autoplot.MAPraster
to quickly visualise MAPraster objects created using as.MAPraster
.
# Download PfPR2-10 Raster for Madagascar and visualise this immediately.
## Not run:
MDG_shp <- getShp(ISO = "MDG", admin_level = "admin0")
MDG_PfPR2_10 <- getRaster(dataset_id = "Malaria__202206_Global_Pf_Parasite_Rate", shp = MDG_shp)
autoplot(MDG_PfPR2_10)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.