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

addWMS with interactive options #52

Open
dustming opened this issue Jan 9, 2023 · 1 comment
Open

addWMS with interactive options #52

dustming opened this issue Jan 9, 2023 · 1 comment
Labels
reprex needs a minimal reproducible example

Comments

@dustming
Copy link

dustming commented Jan 9, 2023

Hi Everyone
I tried to use the addWMS in shiny to plot a map from web services. I want the map from addWMS to change dynamically when I provide a different DateTime to it.
The addWMS could plot the map with provided initial DateTime. However, no map was shown when I change the DateTime with a sidebar. I am sure the input DateTime is correct. and the error from the console are the following.
How I use addWMS in R

  output$mymap <- renderLeaflet({
    leaflet() %>%
      setView(lng = -76, lat = 47, zoom = 4) %>%
      addProviderTiles(providers$OpenStreetMap.Mapnik) %>%
      addWMS(baseUrl = baseUrl,
             layers = "GEPS_Pgrid_3hr",
             options = WMSTileOptions(
               version = "1.3",
               showContours="false",
               #time= "2022-11-10T21:00:00Z",
               time= datetime_list()$few_time,
               styles = "",
               format = "image/png",
               transparent = "true",
               uppercase = "false"
             )
      )
  })

The error from concole

Uncaught TypeError: t.onRemove is not a function
    at e.removeLayer (leaflet.js:5:65194)
    at e.removeFrom (leaflet.js:5:64166)
    at e.remove (leaflet.js:5:64092)
    at e.remove (leaflet.js:5:36838)
    at Object.renderValue (leaflet.js:633:15)
    at Object.renderValue (htmlwidgets.js:889:25)
    at shinyBinding.renderValue (htmlwidgets.js:543:20)
    at e.value (outputBinding.ts:48:12)
    at delegator.<computed> [as onValueChange] (htmlwidgets.js:112:23)
    at e.value (outputAdapter.ts:39:20)
leaflet.js:5 
        
       Uncaught Error: Map container is being reused by another instance
    at e.remove (leaflet.js:5:36414)
    at Object.renderValue (leaflet.js:633:15)
    at Object.renderValue (htmlwidgets.js:889:25)
    at shinyBinding.renderValue (htmlwidgets.js:543:20)
    at e.value (outputBinding.ts:48:12)
    at delegator.<computed> [as onValueChange] (htmlwidgets.js:112:23)
    at e.value (outputAdapter.ts:39:20)
    at e.value (shinyapp.ts:565:17)
    at e.<anonymous> (shinyapp.ts:743:20)
    at e.value (shinyapp.ts:724:29)
leaflet.js:5 
        
       Uncaught TypeError: Cannot read properties of undefined (reading 'style')
    at wt (leaflet.js:5:9820)
    at e.<anonymous> (leaflet.js:5:47376)
    at e.fire (leaflet.js:5:16621)
    at e.invalidateSize (leaflet.js:5:34738)
    at Object.resize (leaflet.js:798:15)
    at Object.resize (htmlwidgets.js:892:25)
    at shinyBinding.resize (htmlwidgets.js:553:24)
    at outputAdapter.ts:26:17
    at e.onResize (index.ts:138:5)
    at HTMLDivElement.<anonymous> (init.ts:266:15)
@trafficonese
Copy link
Owner

Hey, thanks for that issue. Could you maybe post a minimal reproducible example?
It would make debugging much easier for me.

@trafficonese trafficonese added the reprex needs a minimal reproducible example label Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reprex needs a minimal reproducible example
Projects
None yet
Development

No branches or pull requests

2 participants