0

How to apply mapview::popupTable() function to data.frame including multibyte character in column name(using wondows OS)?

library(mapview)
data(atlStorms2005)
test1 <- atlStorms2005

test1@data$日本語 <- as.factor(c("mapview"))
mapview(test1)   
Error in gsub("</", "\\u003c/", payload, fixed = TRUE) : 
  input string 1 is invalid UTF-8
sessionInfo()
    R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Japanese_Japan.932  LC_CTYPE=Japanese_Japan.932    LC_MONETARY=Japanese_Japan.932 LC_NUMERIC=C                  
[5] LC_TIME=Japanese_Japan.932    

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

other attached packages:
[1] mapview_2.0.2      leaflet_1.1.0.9000

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.10      raster_2.5-8      magrittr_1.5      units_0.4-4       gdalUtils_2.0.1.7 munsell_0.4.3     viridisLite_0.2.0
 [8] colorspace_1.3-2  xtable_1.8-2      lattice_0.20-35   R6_2.2.1          foreach_1.4.3     udunits2_0.13     plyr_1.8.4       
[15] tools_3.4.0       webshot_0.4.0     rgdal_1.2-7       grid_3.4.0        png_0.1-7         R.oo_1.21.0       DBI_0.6-1        
[22] htmltools_0.3.6   crosstalk_1.0.1   iterators_1.0.8   digest_0.6.12     sf_0.4-3          shiny_1.0.3       base64enc_0.1-3  
[29] htmlwidgets_0.9   R.utils_2.5.0     codetools_0.2-15  mime_0.5          sp_1.2-4          compiler_3.4.0    scales_0.4.1     
[36] R.methodsS3_1.7.1 stats4_3.4.0      jsonlite_1.4      satellite_0.2.0   httpuv_1.3.3     
MLavoie
  • 9,671
  • 41
  • 36
  • 56
ogw
  • 353
  • 1
  • 2
  • 13
  • My guess is that you are using an old mapview version. I have just tried on windows with the latest CRAN release and it seems to work fine. See also [this issue](https://github.com/r-spatial/mapview/issues/65). So, could you please try with the latest CRAN release and report back whether this solves the issue? – TimSalabim May 16 '17 at 08:02
  • thank you for fixed github issue(#65) and already solved the problem. but questioned code cannot run on my environment. mapview`2.0.1`,`2.0.2`, leaflet`1.1.0`, `1.1.0.9000` – ogw May 17 '17 at 00:38
  • can you pls try your code with leaflet instead of mapview? `leaflet() %>% addTiles() %>% addPolylines(data = atlStorms2005)`. Does this work? The error seems to originate from `htmlwidgets` so may be broader. – TimSalabim May 17 '17 at 05:51
  • `leaflet() %>% addTiles() %>% addPolylines(data = test1)` works. but `leaflet() %>% addTiles() %>% addPolylines(data = test1, popup = popupTable(test1))` does not work. – ogw May 17 '17 at 11:14
  • I'm not convinced I think problem similar to github issue(#65). because no problem questioned code if run this code `colnames(test1@data) <- enc2utf8(colnames(test1@data))` in middle. – ogw May 17 '17 at 11:23
  • Ok, then could you please re-open issue #65 and provide the above example there, thanks. – TimSalabim May 17 '17 at 11:49
  • 1
    This should be fixed now in latest develop version of mapview. Install with `devtools::install_github("r-spatial/mapview@develop")` – TimSalabim May 23 '17 at 04:49
  • Confirmed that it works using develop version even in my environment. thank you. – ogw May 24 '17 at 00:08

0 Answers0