Add an image source to a Mapbox GL or Maplibre GL map
add_image_source(
map,
id,
url = NULL,
data = NULL,
coordinates = NULL,
colors = NULL
)
The modified map object with the new source added.
A map object created by the mapboxgl
or maplibre
function.
A unique ID for the source.
A URL pointing to the image source.
A SpatRaster
object from the terra
package or a RasterLayer
object.
A list of coordinates specifying the image corners in clockwise order: top left, top right, bottom right, bottom left. For SpatRaster
or RasterLayer
objects, this will be extracted for you.
A vector of colors to use for the raster image.