addProviderTiles work but Esri.OceanBasemap option suddenly does not work
Hi there. Unfortunately, the Esri.OceanBasemap tile option is no longer rendering via addProviderTiles (I've tried on my machine R version 4.2.0 and via Posit Cloud 4.2.2). Other tiles continue to render as expected. The code worked fine a few weeks ago.
This code now just renders a blank map:
library(leaflet)
leaflet() %>%
addProviderTiles("Esri.OceanBasemap")
However, I can get the ocean basemap via the leaflet.esri package which suggests the issue may not be on the map server side.
library(leaflet)
library(leaflet.esri)
leaflet() %>%
addEsriBasemapLayer(esriBasemapLayers$Oceans)
Any thoughts?
The Esri.OceanBasemap got retired:
and a new endpoint created (from Ocean_Basemap to Ocean/World_Ocean_Base), which seems to be updated in leaflet-providers on Feb 10, 2023:
This line could be edited:
https://github.com/rstudio/leaflet/blob/ffd4ac8e43c882a8d1280dfc2a971f952b0e1c96/docs/libs/leaflet-providers/leaflet-providers_1.9.0.js#L423
But better to update the whole file to latest with PR. I don't have time at the moment to do this.
After a bit more exploration, I discovered:
- The layer
variantname changed from:
- OLD:
Ocean_Basemap - NEW:
Ocean/World_Ocean_Basefor surface +Ocean/World_Ocean_Referencefor labels
- The file mentioned above leaflet-providers_1.9.0.js is only applicable to the documentation site for this R package. The htmlwidget dependency gets loaded into
libs(or inline) upon rendering to html. The source for theleaflet-providers_{version}.jsactually comes from the leaflet.providers R package, which can pull the latest leaflet-providers - npm via unpkg.com, eg https://unpkg.com/[email protected]/leaflet-providers.js. However, the npm package has not been updated for a year, so it doesn't reflect the latest fix forEsri.OceanBasemapat leaflet-extras/leaflet-providers: leaflet-providers.js#L472 . - Until the latest
leaflet-providers.jsgets updated on npm, here's a reasonable workaround to manually set the propervariantwhile giving you the option of separately displaying Base imagery vs Reference labels and borders:
leaflet() |>
# add base: blue bathymetry and light brown/green topography
addProviderTiles(
"Esri.OceanBasemap",
options = providerTileOptions(
variant = "Ocean/World_Ocean_Base")) |>
# add reference: placename labels and borders
addProviderTiles(
"Esri.OceanBasemap",
options = providerTileOptions(
variant = "Ocean/World_Ocean_Reference"))
OLD: with some previously cached tiles showing up
NEW: with fully functional base and reference layers
