Getting started with rasterpic is easy: you need an image (png, jpeg/jpg, or tif/tiff) and a spatial object from the sf or terra package to begin.
Basic usage
Here we use the shape of Austria as an example:
Options
The function provides several options for expansion, alignment, and cropping.
Expand
With this option, the raster extent is expanded beyond the spatial object:
Alignment
Choose the alignment of the image within the spatial extent:
Crop and mask
Crop and mask the image:
Supported spatial objects for geotagging
- Spatial objects of the sf package:
sf, sfc, sfg, or bbox.
- Spatial objects of the terra package:
SpatRaster, SpatVector, SpatExtent.
- A numeric coordinate vector of the form
c(xmin, ymin, xmax, ymax).
rasterpic can parse the following image formats:
-
png files.
-
jpg/jpeg files.
-
tif/tiff files.