Closed paragemini closed 2 years ago
Thanks, I'll look into this soon.
thanks for your help, Sir
It should work if you don't wrap the pane into pathOptions()
:
addGlPolylines(data = avg9_sf, color = "green", group = "green", pane = "left") %>%
Hey, thanks for the fix. I will try this today. I am working on a project and trying to use addGlPolylines with cross-talk package R. and Whenever I use the gl function I get the below error message :
Error in UseMethod("st_geometry") :
no applicable method for 'st_geometry' applied to an object of class "c('SharedData', 'R6')"
Here is what I am trying to do
bins <- c(0, 0.5, 0.75, 0.9, Inf)
pal <- colorBin(c("#630606", "#FFC300", "#FFD32D", "#139487"), domain = joined$AM_RATIO, bins = bins)
pal2 <- colorBin(c("#630606", "#FFC300", "#FFD32D", "#139487"), domain = joined$PM_RATIO, bins = bins)
m <- leaflet() %>%
addProviderTiles(providers$CartoDB) %>%
addPolylines( data = sd_map,weight = 2, color = ~pal(AM_RATIO), fillOpacity = 0.8, popup = ~as.character(AM_RATIO), group = "AM", opacity = 0.8) %>% syncWith("maps")
p <- leaflet() %>%
addProviderTiles(providers$CartoDB) %>%
addGlPolylines( data = sd_map,weight = 2, color = ~pal2(PM_RATIO), fillOpacity = 0.8, popup = ~as.character(PM_RATIO), group = "PM") %>% syncWith("maps") %>% addLegend(
pal = pal, values = joined$AM_RATIO, opacity = 0.7, title = "Congested Ratio", position = "bottomright")
combineWidgets(m,p, ncol = 2)
my session info is below, if you want I can probably send a reproducible example
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] manipulateWidget_0.11.1 leaflet.minicharts_0.6.2
[3] cartography_3.0.1 rmarkdown_2.11
[5] plotly_4.10.0 ggplot2_3.3.5
[7] leafpop_0.1.0 leaflet.extras2_1.1.0
[9] stringr_1.4.0 viridis_0.6.2
[11] viridisLite_0.4.0 purrr_0.3.4
[13] rgdal_1.5-28 sp_1.4-6
[15] echarts4r_0.4.3 htmlwidgets_1.5.4
[17] leafgl_0.1.1 leaflet_2.0.4.1
[19] tidyr_1.2.0 dplyr_1.0.8
[21] foreign_0.8-81 data.table_1.14.2
[23] sf_1.0-6 crosstalk_1.2.0
[25] flexdashboard_0.5.2
loaded via a namespace (and not attached):
[1] httr_1.4.2 sass_0.4.0
[3] jsonlite_1.7.3 bslib_0.3.1
[5] shiny_1.7.1 yaml_2.2.2
[7] pillar_1.7.0 lattice_0.20-45
[9] glue_1.6.1 uuid_1.0-3
[11] digest_0.6.29 promises_1.2.0.1
[13] leaflet.providers_1.9.0 colorspace_2.0-2
[15] jsonify_1.2.1 htmltools_0.5.2
[17] httpuv_1.6.5 pkgconfig_2.0.3
[19] s2_1.0.7 xtable_1.8-4
[21] scales_1.1.1 brew_1.0-7
[23] svglite_2.1.0 later_1.3.0
[25] tibble_3.1.6 proxy_0.4-26
[27] farver_2.1.0 generics_0.1.2
[29] ellipsis_0.3.2 DT_0.20
[31] withr_2.4.3 lazyeval_0.2.2
[33] cli_3.1.1 magrittr_2.0.2
[35] crayon_1.4.2 mime_0.12
[37] evaluate_0.14 fansi_1.0.2
[39] class_7.3-19 geojsonsf_2.0.1
[41] tools_4.1.2 lifecycle_1.0.1
[43] munsell_0.5.0 jquerylib_0.1.4
[45] compiler_4.1.2 e1071_1.7-9
[47] systemfonts_1.0.4 tinytex_0.36
[49] rlang_1.0.1 classInt_0.4-3
[51] units_0.8-0 grid_4.1.2
[53] rstudioapi_0.13 miniUI_0.1.1.1
[55] labeling_0.4.2 base64enc_0.1-3
[57] wk_0.6.0 gtable_0.3.0
[59] DBI_1.1.2 R6_2.5.1
[61] gridExtra_2.3 knitr_1.37
[63] fastmap_1.1.0 rgeos_0.5-9
[65] utf8_1.2.2 KernSmooth_2.23-20
[67] stringi_1.7.6 Rcpp_1.0.8
[69] vctrs_0.3.8 tidyselect_1.1.1
[71] xfun_0.29
the fix is to use addGlPolylines like this :
addGlPolylines( data = sd_map$data(),weight = 2, color = ~pal(AM_RATIO), fillOpacity = 0.8, popup = ~round(AM_RATIO,2), group = "AM", opacity = 0.8)
Can we close this issue then?
thanks for your help!
Hello,
I am trying to put two large shapefiles using addGlPolylines() on the left and the right pane using addSidebyside function but for some reason the functionality does not appear to work.
When using addPolylines the feature works well (side-by-side) but as soon as I use addGlPolylines() the shapefile appears on both the panes, as if it does not recognize the two layers.
Any help on this would be greatly appreciated