r-spatial / leafgl

R package for fast web gl rendering for leaflet
Other
262 stars 31 forks source link

leafgl not rendering using examples in package #98

Open nevilamos opened 6 days ago

nevilamos commented 6 days 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 6 days ago

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