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

Stamen Tile Deprecation Warning #883

Open
jmelichar opened this issue Oct 5, 2023 · 3 comments
Open

Stamen Tile Deprecation Warning #883

jmelichar opened this issue Oct 5, 2023 · 3 comments
Assignees

Comments

@jmelichar
Copy link


When zooming in on some areas of the leaflet maps, I now get a deprecation warning from Stamen:

"These basemap tiles will no longer be available as of October 31, 2023. The site administrator can upgrade to the new map at stamen.com/faq"

How will the paid partnership with Stadia Maps work with leaflet?

@gadenbuie
Copy link
Member

Reprex

Here's a reprex using a map from leaflet's documentation:

m <- leaflet() %>% setView(lng = -71.0589, lat = 42.3601, zoom = 12)

m %>%
  addTiles() %>%
  addProviderTiles(providers$Stamen.Toner)

image

Stamen has begun rolling brown-outs where certain basemap tiles are replaced with a warning statement as seen above.

Background

Here are some additional links I've found helpful that discuss the transition.

From the last link:

The Stamen maps are available with all of our plans and priced as normal vector or raster map tiles. Get started for as little as $20 / month—or free if your project is non-commercial!

leaflet (the R package) sources tile providers via leaflet.providers (another R package) which wraps leaflet-providers (a JavaScript library). leaflet-providers has already been updated to use the new Stadia URLs and the R package will be updated shortly to provide the latest leaflet-providers.

This change will clearly impact leaflet (r-pkg) users, as the Stamen map tiles will require an API key. I think the most likely scenario is that Stamen map tile users will need to create an account with Stadia and use the domain-based registration to associate the domain where the map is hosted with their account.

It's unlikely that we will support the URL-based API key, unless its also supported by leaflet-providers (JS). The current instructions on the leafleft-providers README indicate that domain registration is currently the recommended approach.

@gadenbuie gadenbuie pinned this issue Oct 5, 2023
@gadenbuie gadenbuie self-assigned this Oct 5, 2023
@gadenbuie
Copy link
Member

With the latest leaflet.providers, now available on GitHub via

remotes::install_github("rstudio/leaflet.providers")

it appears that the Stamen tiles will continue to work for now with the name Stadia.Stamen____

m <- leaflet() %>% setView(lng = -71.0589, lat = 42.3601, zoom = 12)

m %>%
  addTiles() %>%
  addProviderTiles(providers$Stadia.StamenToner)
image

but there's a chance that in the future they may look like other Stadia tiles that require an account, e.g.

m %>%
  addTiles() %>%
  addProviderTiles(providers$Stadia.Outdoors)
image

@ianthetechie
Copy link

Sorry to necro this old thread, but in case anyone finds this via search, I wanted to confirm that yes, the tiles do require an account since the end of October (free for basically all R users unless you use a positively insane number of tiles or want satellite imagery), but we have a carve-out for localhost development. Leaflet in R Studio should "just work." If you deploy to a website though (ex: using Shiny), you'll need an account, and we'd recommend domain-based auth for these use cases.

We ensure that the upstream (JS) Leaflet Providers package is up to date, so everything should work if you have an up-to-date rstudio/leaflet.providers package. and have no intention of further URL breakage (the October cutoff was due to Stamen needing to migrate off the expensive Fastly CDN).

It's unlikely that we will support the URL-based API key, unless its also supported by leaflet-providers (JS). The current instructions on the leafleft-providers README indicate that domain registration is currently the recommended approach.

That's correct... Leaflet is mostly a web library, but we had not considered downstream implementations like use in R and want to use an API key. I may have missed something, but it seems like the API key is either there or net in Leaflet Providers, so we opted to not add the parameter. If you really want to use an API key (ex: for an intranet deployment), you can still do that like this:

library(leaflet)

map <- leaflet() %>%
addTiles(
    urlTemplate = "https://tiles.stadiamaps.com/tiles/{variant}/{z}/{x}/{y}{r}.png?api_key={apikey}",
    attribution = paste('&copy; <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a> ' ,
							'&copy; <a href="https://stamen.com/" target="_blank">Stamen Design</a> ' ,
							'&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' ,
							'&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>'),
    options = tileOptions(variant='stamen_toner_lite', apikey = 'YOUR-API-KEY')
    )  %>%
fitBounds(lng1 = -86.1581, lat1 = 39.7684, lng2 = -87.1581, lat2 = 40.7684)

map

If anyone hits any issues here, feel free to mention me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants