leafsync icon indicating copy to clipboard operation
leafsync copied to clipboard

No data displayed with sync

Open oscarperpinan opened this issue 11 months ago • 6 comments

Hello,

The sync function shows a strange behaviour. The maps created with mapview display both the data and the underlying layer. However, when these maps are shown together with sync, the data is missing.

library(sp)
library(mapview)
library(leafsync)

data(meuse)
coordinates(meuse) <- ~x+y
proj4string(meuse) <- CRS("+init=epsg:28992")

## view different aspects of same data set
m1 <- mapview(meuse, zcol = "soil", burst = TRUE)
m2 <- mapview(meuse, zcol = "lead")
m3 <- mapview(meuse, zcol = "landuse", map.types = "Esri.WorldImagery")
m4 <- mapview(meuse, zcol = "dist.m")
m1 #correct

Captura de pantalla_2024-03-01_14-09-38

sync(m1, m2, m3, m4) #no data

Captura de pantalla_2024-03-01_14-10-17

oscarperpinan avatar Mar 01 '24 13:03 oscarperpinan

Can you try to set mapviewOptions(fgb = FALSE) before creating the mapview maps and see whether that works?

tim-salabim avatar Mar 01 '24 15:03 tim-salabim

Thanks. Checked, it works now.

From the help file of mapviewOptions I understand that with fgb = TRUE a folder with the data is needed, but it's not clear to me if this folder is created automatically.

oscarperpinan avatar Mar 02 '24 16:03 oscarperpinan

With fgb = TRUE the data is attached to the HTML file, rather than included. I think if you set different layer.names for the maps, things should also work with fgb = TRUE

tim-salabim avatar Mar 02 '24 17:03 tim-salabim

Sorry, but I don't understand what do you mean with different layer.names. The meuse object is a SpatialPointsDataFrame whose names are all different. By the way, the example of this issue is just a copy of the one included in your README.

oscarperpinan avatar Mar 03 '24 00:03 oscarperpinan

If I run the example as is (i.e. with fgb = TRUE), it works for me: image

What's your sessionInfo()?

Forget my comment about layer.names, they are being set correctly in mapview, when you specify a zcol.

tim-salabim avatar Mar 03 '24 08:03 tim-salabim

R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux trixie/sid

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0

locale:
 [1] LC_CTYPE=es_ES.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=es_ES.UTF-8        LC_COLLATE=es_ES.UTF-8    
 [5] LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=es_ES.UTF-8   
 [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Madrid
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] rgl_0.111.6         leafsync_0.1.0      leafpop_0.1.0      
 [4] mapview_2.11.2      gstat_2.1-1         ggrepel_0.9.5      
 [7] osmdata_0.2.5       classInt_0.4-3      sp_1.4-5           
[10] sf_1.0-15           RColorBrewer_1.1-3  latticeExtra_0.6-29
[13] ggplot2_3.3.5       lattice_0.22-5     

loaded via a namespace (and not attached):
 [1] gtable_0.3.0            xfun_0.28               servr_0.27             
 [4] raster_3.6-26           httr2_1.0.0             htmlwidgets_1.6.1      
 [7] leaflet.providers_2.0.0 vctrs_0.4.1             tools_4.3.2            
[10] crosstalk_1.2.0         generics_0.1.1          stats4_4.3.2           
[13] curl_4.3.2              tibble_3.1.6            proxy_0.4-26           
[16] spacetime_1.3-1         fansi_0.5.0             xts_0.13.2             
[19] pkgconfig_2.0.3         KernSmooth_2.23-22      satellite_1.0.4        
[22] uuid_1.2-0              leaflet_2.2.1           lifecycle_1.0.1        
[25] compiler_4.3.2          farver_2.1.0            FNN_1.1.4              
[28] munsell_0.5.0           terra_1.7-29            codetools_0.2-19       
[31] httpuv_1.6.14           htmltools_0.5.7         class_7.3-22           
[34] later_1.3.2             pillar_1.6.4            crayon_1.4.2           
[37] jquerylib_0.1.4         ellipsis_0.3.2          brew_1.0-10            
[40] tidyselect_1.1.2        digest_0.6.28           dplyr_1.0.9            
[43] purrr_0.3.4             fastmap_1.1.1           grid_4.3.2             
[46] colorspace_2.0-2        cli_3.3.0               magrittr_2.0.1         
[49] base64enc_0.1-3         utf8_1.2.2              leafem_0.2.3           
[52] e1071_1.7-9             withr_2.4.2             promises_1.2.1         
[55] scales_1.1.1            rappdirs_0.3.3          lubridate_1.8.0        
[58] jpeg_0.1-9              zoo_1.8-9               png_0.1-7              
[61] knitr_1.36              rgdal_1.6-4             rlang_1.1.3            
[64] Rcpp_1.0.10             glue_1.6.2              DBI_1.1.1              
[67] xml2_1.3.6              svglite_2.1.3           jsonlite_1.7.2         
[70] rstudioapi_0.15.0       R6_2.5.1                systemfonts_1.0.5      
[73] intervals_0.15.4        units_0.7-2            

oscarperpinan avatar Mar 03 '24 13:03 oscarperpinan