The viz_clipPath function creates an SVG clipPath definition
and adds it to the SVG defs. It returns a reference usable in SVG styling
(e.g. url(#id)). WARNING: the clipPath is global to the web page, not only the map.
Usage
viz_clipPath(map, id = NULL, datum = list(type = "Sphere"), permanent = FALSE)Examples
library(sf)
world <- st_read(
system.file("gpkg/world.gpkg", package = "geoviz"),
quiet = TRUE
)
aus <- world[world$ISO3 == "AUS", ]
viz_create(margin = 5, projection = "meractor") |>
viz_clipPath(id = "ausclip", datum = aus) |>
viz_tile(url = "worldStreet", clipPath = "url(#ausclip)") |>
viz_render()