Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mtennekes committed Jun 10, 2024
1 parent 4a825bc commit d7a439e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions R/tm_layers_aux.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions R/tmapLeafletAux.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d7a439e

Please sign in to comment.