r-spatial / leafgl

R package for fast web gl rendering for leaflet
https://r-spatial.github.io/leafgl/
Other
267 stars 32 forks source link

leafgl not rendering using examples in package #98

Open nevilamos opened 4 months ago

nevilamos commented 4 months ago

Using the example script the background map renders but there are no glpoints or gl lines added viewer console state that leafletwidgedt is not defined

library(leaflet) library(leafgl) library(sf)

storms = st_as_sf(atlStorms2005)

cols = heat.colors(nrow(storms))

leaflet() %>% addProviderTiles(provider = providers$CartoDB.Positron) %>% addGlPolylines(data = storms, color = cols, popup = TRUE, opacity = 1)

library(leaflet) library(leafgl) library(sf)

n = 1e5

df1 = data.frame(id = 1:n, x = rnorm(n, 10, 1), y = rnorm(n, 49, 0.8)) pts = st_as_sf(df1, coords = c("x", "y"), crs = 4326)

cols = topo.colors(nrow(pts)) leaflet() %>% addProviderTiles(provider = providers$CartoDB.DarkMatter) %>% addGlPoints(data = pts, fillColor = cols, popup = TRUE)

no error in rtudio console - just background map plotted in viewer and the following in the viewer console: addGlifyPoints.js:1 Uncaught ReferenceError: LeafletWidget is not defined at addGlifyPoints.js:1:1 (anonymous) @ addGlifyPoints.js:1 addGlifyPolygons.js:1 Uncaught ReferenceError: LeafletWidget is not defined at addGlifyPolygons.js:1:1 addGlifyPolylines.js:1 Uncaught ReferenceError: LeafletWidget is not defined at addGlifyPolylines.js:1:1 leaflet.js:2752 Unknown method addGlifyPolylines DevTools failed to load source map: Could not parse content for http://localhost:17977/glify-browser.js.map: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

tim-salabim commented 4 months ago

Is this the CRAN or the dev version from here? If CRAN, please try dev

fricour commented 1 month ago

Hi,

Had the same issue, using the github version solved the issue.