get_wmts {happign} | R Documentation |
Download WMTS raster tiles
Description
Download an RGB raster layer from IGN Web Map Tile Services (WMTS). WMTS focuses on performance and can only query pre-calculated tiles.
Usage
get_wmts(x,
layer = "ORTHOIMAGERY.ORTHOPHOTOS",
zoom = 10L,
crs = 2154,
filename = tempfile(fileext = ".tif"),
overwrite = FALSE,
interactive = FALSE)
Arguments
x |
Object of class |
layer |
|
zoom |
|
crs |
|
filename |
|
overwrite |
If TRUE, output raster is overwrite. |
interactive |
|
Value
SpatRaster
object from terra
package.
See Also
get_apikeys()
, get_layers_metadata()
Examples
## 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)