get_wmts | R Documentation |
Download an RGB raster layer from IGN Web Map Tile Services (WMTS). WMTS focuses on performance and can only query pre-calculated tiles.
get_wmts(x,
layer = "ORTHOIMAGERY.ORTHOPHOTOS",
zoom = 10L,
crs = 2154,
filename = tempfile(fileext = ".tif"),
verbose = FALSE,
overwrite = FALSE,
interactive = FALSE)
x |
Object of class |
layer |
|
zoom |
|
crs |
|
filename |
|
verbose |
|
overwrite |
If TRUE, output raster is overwrite. |
interactive |
|
SpatRaster
object from terra
package.
get_apikeys()
, get_layers_metadata()
## Not run:
library(sf)
library(tmap)
penmarch <- read_sf(system.file("extdata/penmarch.shp", package = "happign"))
# Get orthophoto
layers <- get_layers_metadata("wmts", "ortho")$Identifier
ortho <- get_wmts(penmarch, layer = layers[1], zoom = 21)
plotRGB(ortho)
# Get all available irc images
layers <- get_layers_metadata("wmts", "orthohisto")$Identifier
irc_names <- grep("irc", layers, value = TRUE, ignore.case = TRUE)
irc <- lapply(irc_names, function(x) get_wmts(penmarch, layer = x, zoom = 18)) |>
setNames(irc_names)
# remove empty layer (e.g. only NA)
irc <- Filter(function(x) !all(is.na(values(x))), irc)
# plot
all_plots <- lapply(irc, plotRGB)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.