diff --git a/R/tm_layers_aux.R b/R/tm_layers_aux.R index 99dbb43a..b0d96fa3 100644 --- a/R/tm_layers_aux.R +++ b/R/tm_layers_aux.R @@ -13,6 +13,7 @@ #' Use `NULL` in `tm_basemap()` to disable basemaps. #' @param alpha Transparency level #' @param zoom Zoom level (only used in plot mode) +#' @param max.native.zoom Maximum native zoom level (only used in view mode). The minimum and maximum zoom levels are determined in `tm_view`. #' @param zindex zindex of the pane in view mode. By default, it is set to the #' layer number plus 400. By default, the tmap layers will therefore be placed #' in the custom panes `"tmap401"`, `"tmap402"`, etc., except for the base tile @@ -31,9 +32,9 @@ #' @rdname tm_basemap #' @name tm_basemap #' @example ./examples/tm_basemap.R -tm_basemap = function(server = NULL, alpha = NULL, zoom = NULL, zindex = 0, group = NA, group.control = "radio") { +tm_basemap = function(server = NULL, alpha = NULL, zoom = NULL, max.native.zoom = 17, zindex = 0, group = NA, group.control = "radio") { tm_element_list(tm_element( - args = list(server = server, alpha = alpha, zoom = zoom, type = "basemap"), + args = list(server = server, alpha = alpha, zoom = zoom, max.native.zoom = max.native.zoom, type = "basemap"), mapping.fun = "Tiles", zindex = zindex, group = group, @@ -44,9 +45,9 @@ tm_basemap = function(server = NULL, alpha = NULL, zoom = NULL, zindex = 0, grou #' @export #' @rdname tm_basemap #' @name tm_tiles -tm_tiles = function(server = NULL, alpha = NULL, zoom = NULL, zindex = NA, group = NA, group.control = "check") { +tm_tiles = function(server = NULL, alpha = NULL, zoom = NULL, max.native.zoom = 1, zindex = NA, group = NA, group.control = "check") { tm_element_list(tm_element( - args = list(server = server, alpha = alpha, zoom = zoom, type = "overlay"), + args = list(server = server, alpha = alpha, zoom = zoom, max.native.zoom = max.native.zoom, type = "overlay"), mapping.fun = "Tiles", zindex = zindex, group = group, diff --git a/R/tmapLeafletAux.R b/R/tmapLeafletAux.R index 2f011ee0..4100d474 100644 --- a/R/tmapLeafletAux.R +++ b/R/tmapLeafletAux.R @@ -14,9 +14,9 @@ tmapLeafletTiles = function(bi, bbx, facet_row, facet_col, facet_page, id, pane, tiles = .TMAP_LEAFLET$tiles[[id]][[bi]] if (o$credits.defined) { - opt = list(attribution = "") + opt = leaflet::providerTileOptions(attribution = "", maxNativeZoom = tiles$max.native.zoom, maxZoom = o$set.zoom.limits[2]) } else { - opt = list() + opt = leaflet::providerTileOptions(maxNativeZoom = tiles$max.native.zoom, maxZoom = o$set.zoom.limits[2]) } for (s in tiles$server) lf = leaflet::addProviderTiles(lf, provider = s, group = s, options = opt)