R/shiny_leaflet.R

Defines functions renderTmapGS.Leaflet

#' @exportS3Method
renderTmapGS.Leaflet <- function(x, expr, env, ...) {
	expr <- bquote(getFromNamespace("print.tmap", "tmap")(.(expr), in.shiny = TRUE))
	htmlwidgets::shinyRenderWidget(expr, leaflet::leafletOutput, env, quoted = TRUE)
}

#' @exportS3Method
tmapOutputGS.Leaflet <- function(x, outputId, width, height, ...) {
	leaflet::leafletOutput(outputId = outputId, width = width, height = height)
}

#' @exportS3Method
tmapProxyGS.Leaflet <- function(x, mapId, session, tmobj, ...) {
	print.tmap(tmobj,
			   lf = leaflet::leafletProxy(mapId, session),
			   show = FALSE, in.shiny = TRUE, proxy = TRUE)
}

Try the tmap package in your browser

Any scripts or data that you put into this service are public.

tmap documentation built on June 26, 2026, 5:08 p.m.