Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: replace Stamen/Stadia in vignettes, function documentation, and inst examples #913

Merged
merged 5 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions R/layers.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ hideGroup <- function(map, group) {
#' addMarkers(data = quakes, group = "basic") %>%
#' # When zoomed in, we'll show circles at the base of each marker whose
#' # radius and color reflect the magnitude
#' addProviderTiles(providers$Stamen.TonerLite, group = "detail") %>%
#' addProviderTiles(providers$Esri.WorldTopoMap, group = "detail") %>%
#' addCircleMarkers(data = quakes, group = "detail", fillOpacity = 0.5,
#' radius = ~mag * 5, color = ~pal(mag), stroke = FALSE) %>%
#' # Set the detail group to only appear when zoomed in
Expand Down Expand Up @@ -1608,10 +1608,10 @@ clearGeoJSON <- function(map) {
#' \donttest{
#' leaflet() %>%
#' addTiles(group = "OpenStreetMap") %>%
#' addProviderTiles("Stamen.Toner", group = "Toner by Stamen") %>%
#' addProviderTiles("CartoDB.Voyager", group = "Carto Voyager") %>%
#' addMarkers(runif(20, -75, -74), runif(20, 41, 42), group = "Markers") %>%
#' addLayersControl(
#' baseGroups = c("OpenStreetMap", "Toner by Stamen"),
#' baseGroups = c("OpenStreetMap", "Carto Voyager"),
#' overlayGroups = c("Markers")
#' )
#' }
Expand Down
4 changes: 2 additions & 2 deletions R/plugin-providers.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ leafletProviderDependencies <- function() {
#'
#' @examples
#' leaflet() %>%
#' addProviderTiles("Stamen.Watercolor") %>%
#' addProviderTiles("Stamen.TonerHybrid")
#' addProviderTiles("Esri.WorldTopoMap") %>%
#' addProviderTiles("CartoDB.DarkMatter")
#'
#' @export
addProviderTiles <- function(
Expand Down
10 changes: 5 additions & 5 deletions inst/examples/geojson.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ icons <- awesomeIconList(
leaflet() %>% addTiles() %>%
setView(10.758276373601069, 59.92448055859924, 13) %>%
addAwesomeMarkers(data = spdf,
label = ~stringr::str_c(amenity, ": ", name),
icon = ~icons[amenity],
options = markerOptions(riseOnHover = TRUE, opacity = 0.75),
group = "pubs")
label = ~stringr::str_c(amenity, ": ", name),
icon = ~icons[amenity],
options = markerOptions(riseOnHover = TRUE, opacity = 0.75),
group = "pubs")


#' <br/><br/>
Expand All @@ -36,7 +36,7 @@ mhSPDF <- geojsonio::geojson_read(url, what = "sp")

cols <- colorFactor(topo.colors(nrow(mhSPDF)), mhSPDF$NAME_2)

leaflet() %>% addProviderTiles(providers$Stamen.TonerLite) %>%
leaflet() %>% addProviderTiles(providers$CartoDB.Voyager) %>%
setView(75.7139, 19.7515, 6) %>%
addPolygons(data = mhSPDF, opacity = 5,
label = ~NAME_2, weight = 1,
Expand Down
6 changes: 3 additions & 3 deletions inst/examples/providers-shiny.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ ui <- fluidPage(
selectInput(
"providerName",
"Tile set",
c("Stamen.Toner",
"Stamen.TonerLite",
"Stamen.Watercolor")
c("CartoDB.Positron",
"CartoDB.Voyager",
"CartoDB.DarkMatter")
)
),
column(
Expand Down
4 changes: 2 additions & 2 deletions man/addLayersControl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/addProviderTiles.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/groupOptions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/leaflet-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vignettes/articles/basemaps.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Alternatively, many popular free third-party basemaps can be added using the `ad
As a convenience, leaflet also provides a named list of all the third-party tile providers that are supported by the plugin. This enables you to use auto-completion feature of your favorite R IDE (like RStudio) and not have to remember or look up supported tile providers; just type `providers$` and choose from one of the options. You can also use `names(providers)` to view all of the options.

```{r fig.height=1.25}
m %>% addProviderTiles(providers$Stadia.StamenToner)
m %>% addProviderTiles(providers$CartoDB.Positron)
m %>% addProviderTiles(providers$Esri.NatGeoWorldMap)
m %>% addProviderTiles(providers$OpenTopoMap)
```

Note that some tile set providers require you to register; see the [project page](https://github.com/leaflet-extras/leaflet-providers) for more information. You can pass access tokens/keys, and other options, to the tile provider by populating the `options` argument with the `providerTileOptions()` function.
Expand Down Expand Up @@ -59,8 +59,8 @@ leaflet() %>% addTiles() %>% setView(-93.65, 42.0285, zoom = 4) %>%
You aren't restricted to using a single basemap on a map; you can stack them by adding multiple tile layers. This generally only makes sense if the front tiles consist of semi transparent tiles, or have an adjusted opacity via the `options` argument.

```{r fig.height=1.75}
m %>% addProviderTiles(providers$MtbMap) %>%
addProviderTiles(providers$Stadia.StamenTonerLines,
options = providerTileOptions(opacity = 0.35)) %>%
addProviderTiles(providers$Stadia.StamenTonerLabels)
m %>%
addProviderTiles(providers$Esri.WorldImagery,
options = providerTileOptions(opacity = 0.5)) %>%
addProviderTiles(providers$CartoDB.VoyagerOnlyLabels)
```
Binary file modified vignettes/articles/images/shiny1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion vignettes/articles/shiny.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ server <- function(input, output, session) {

output$mymap <- renderLeaflet({
leaflet() %>%
addProviderTiles(providers$Stadia.StamenTonerLite,
addProviderTiles(providers$CartoDB.Positron,
options = providerTileOptions(noWrap = TRUE)
) %>%
addMarkers(data = points())
Expand Down
30 changes: 24 additions & 6 deletions vignettes/articles/showhide.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,33 @@ outline <- quakes[chull(quakes$long, quakes$lat),]
map <- leaflet(quakes) %>%
# Base groups
addTiles(group = "OSM (default)") %>%
addProviderTiles(providers$Stadia.StamenToner, group = "Toner") %>%
addProviderTiles(providers$Stadia.StamenTonerLite, group = "Toner Lite") %>%
addProviderTiles(providers$CartoDB.Positron, group = "Positron (minimal)") %>%
addProviderTiles(providers$Esri.WorldImagery, group = "World Imagery (satellite)") %>%
# Overlay groups
addCircles(~long, ~lat, ~10^mag/5, stroke = FALSE, group = "Quakes") %>%
addPolygons(data = outline, lng = ~long, lat = ~lat,
fill = FALSE, weight = 2, color = "#FFFFCC", group = "Outline") %>%
addCircles(
~ long,
~ lat,
~ 10 ^ mag / 5,
stroke = FALSE,
group = "Quakes",
fillColor = "tomato"
) %>%
addPolygons(
data = outline,
lng = ~ long,
lat = ~ lat,
fill = FALSE,
weight = 2,
color = "#FFFFCC",
group = "Outline"
) %>%
# Layers control
addLayersControl(
baseGroups = c("OSM (default)", "Toner", "Toner Lite"),
baseGroups = c(
"OSM (default)",
"Positron (minimal)",
"World Imagery (satellite)"
),
overlayGroups = c("Quakes", "Outline"),
options = layersControlOptions(collapsed = FALSE)
)
Expand Down
Loading