Skip to content

Leaflet basemaps don't appear in RStudio Viewer Pane #946

@jaum20

Description

@jaum20

Simple leaflet maps are no showing on the Rstudio Viewer pane, but I can open the generated html from the tmp folder. This only happens with the base map, other Polygons added are showing.

library(leaflet)
leaflet( ) %>% addTiles()

Image

library(geobr)
library(dplyr)
library(leaflet)

biomas <- geobr::read_biomes()

pal <- colorFactor(
  palette = "Set2",
  domain = biomas$name_biome
)

leaflet(data = biomas) %>%
  addTiles() %>%  
  addPolygons(
    fillColor = ~pal(name_biome),
    weight = 1,
    opacity = 0.5,
    color = "white",
    dashArray = "3",
    fillOpacity = 0.4, 
    highlight = highlightOptions(
      weight = 2,
      color = "#666",
      dashArray = "",
      fillOpacity = 0.7,
      bringToFront = TRUE
    ),
    label = ~name_biome
  ) %>%
  addLegend(
    pal = pal,
    values = ~name_biome,
    title = "Biomas do Brasil",
    position = "bottomright"
  )

Image

Image

platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 4
minor 4.3
year 2025
month 02
day 28
svn rev 87843
language R
version.string R version 4.4.3 (2025-02-28)
nickname Trophy Case

RStudio
2024.12.1 Build 563

leaflet 2.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions