rasterpic is very easy! You just need a
and a spatial object (from the
sf or the
terra) package to start using it.
We use here as an example the shape of Austria:
library(sf) library(terra) library(rasterpic) # Plot library(tidyterra) library(ggplot2) # Shape and image x <- read_sf(system.file("gpkg/austria.gpkg", package = "rasterpic")) img <- system.file("img/vertical.png", package = "rasterpic") # Create! default <- rasterpic_img(x, img) autoplot(default) + geom_sf(data = x)
The function provides several options for expanding, alignment and cropping.
With this option the image is zoomed out of the spatial object:
Decide where to align the image:
Spatial object of the
Spatial objects of the
A vector of coordinates with the form
c(xmin, ymin, xmax, yman)
rasterpic can parse the following image formats: