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

addProviderTiles work but Esri.OceanBasemap option suddenly does not work #841

Open
NathanWhitmore opened this issue Jan 12, 2023 · 2 comments

Comments

@NathanWhitmore
Copy link

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?

@NathanWhitmore NathanWhitmore changed the title addProviderTiles work but Esri.OceanBasemap option suddenly does not addProviderTiles work but Esri.OceanBasemap option suddenly does not work Jan 20, 2023
@bbest
Copy link

bbest commented Feb 23, 2023

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:

But better to update the whole file to latest with PR. I don't have time at the moment to do this.

@bbest
Copy link

bbest commented Feb 23, 2023

After a bit more exploration, I discovered:

  1. The layer variant name changed from:
  • OLD: Ocean_Basemap
  • NEW: Ocean/World_Ocean_Base for surface + Ocean/World_Ocean_Reference for labels
  1. 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 the leaflet-providers_{version}.js actually comes from the leaflet.providers R package, which can pull the latest leaflet-providers - npm via unpkg.com, eg https://unpkg.com/leaflet-providers@1.13.0/leaflet-providers.js. However, the npm package has not been updated for a year, so it doesn't reflect the latest fix for Esri.OceanBasemap at leaflet-extras/leaflet-providers: leaflet-providers.js#L472 .
  2. Until the latest leaflet-providers.js gets updated on npm, here's a reasonable workaround to manually set the proper variant while 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

image

NEW: with fully functional base and reference layers

image

bbest added a commit to marineenergy/apps that referenced this issue Mar 2, 2023
bbest added a commit to noaa-onms/sanctsound that referenced this issue Dec 12, 2023
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

2 participants