Closed jack-davison closed 1 month ago
@schloerke, you gave this example in https://github.com/rstudio/leaflet/issues/921#issuecomment-2252807843_
addProviderTiles <- function(
map,
provider,
layerId = NULL,
group = NULL,
options = providerTileOptions(),
...,
check = TRUE
) {
if (isTRUE(check)) {
check_provider(provider)
}
map$dependencies <- c(map$dependencies, leafletProviderDependencies())
invokeMethod(map, getMapData(map), "addProviderTiles",
provider, layerId, group, options)
}
addProviderTiles()
didn't originally have a ...
param - I've added it as per your example, but it currently doesn't do anything! Did you want it adding for some reason, or was it just a mistake in your suggestion?
Thank you, @jack-davison !
Fixes #921 Fixes #677
In short, it adds the
.check
arg toaddProviderTiles()
, which defaults toTRUE
. WhenTRUE
, if a user mistakenly provides a provider not inleaflet.providers::providers_loaded()
, the function will error.Also adds a test to check this new argument is working as it should.
PR task list:
tests/testthat/
R/zzz_viztest.R
devtools::document()