mapview icon indicating copy to clipboard operation
mapview copied to clipboard

Highlight options are ignored for sf polygons

Open kptitov opened this issue 4 years ago • 3 comments

Hi @tim-salabim mapview ignores the highlight options I pass to it when plotting polygons: mapview::mapview(franconia, highlight = leaflet::highlightOptions(color = "blue", weight = 2, sendToBack=TRUE)) It renders the polygons, but there is no highlighting on hover: image I get this issue with both the development version installed from github and with the CRAN version of mapview.

sessionInfo: R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale: [1] LC_COLLATE=German_Austria.1252 LC_CTYPE=German_Austria.1252 LC_MONETARY=German_Austria.1252 LC_NUMERIC=C
[5] LC_TIME=German_Austria.1252

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

other attached packages: [1] mapview_2.10.2

loaded via a namespace (and not attached): [1] Rcpp_1.0.6 RColorBrewer_1.1-2 compiler_4.1.0 pillar_1.6.2 base64enc_0.1-3
[6] class_7.3-19 tools_4.1.0 digest_0.6.27 jsonlite_1.7.2 tibble_3.1.2
[11] satellite_1.0.2 lifecycle_1.0.0 lattice_0.20-44 pkgconfig_2.0.3 png_0.1-7
[16] rlang_0.4.11 DBI_1.1.1 crosstalk_1.1.1 yaml_2.2.1 e1071_1.7-7
[21] dplyr_1.0.7 raster_3.4-10 leaflet.providers_1.9.0 generics_0.1.0 htmlwidgets_1.5.3
[26] vctrs_0.3.8 webshot_0.5.2 tidyselect_1.1.1 stats4_4.1.0 classInt_0.4-3
[31] leaflet_2.0.4.1 grid_4.1.0 glue_1.4.2 sf_0.9-8 R6_2.5.0
[36] fansi_0.5.0 sp_1.4-5 purrr_0.3.4 magrittr_2.0.1 scales_1.1.1
[41] codetools_0.2-18 htmltools_0.5.1.1 ellipsis_0.3.2 units_0.7-1 assertthat_0.2.1
[46] colorspace_2.0-1 KernSmooth_2.23-20 utf8_1.2.1 proxy_0.4-25 munsell_0.5.0
[51] leafem_0.1.6 crayon_1.4.1

kptitov avatar Aug 30 '21 10:08 kptitov

You can make it work by setting

mapviewOptions(fgb = FALSE)

for the default rendering using fgb = TRUE we still need to implement this. But I want to upgrade the underlying js library first, so it will take a while.

tim-salabim avatar Sep 04 '21 08:09 tim-salabim

Thanks for getting back to me! fgb = TRUE is actually the reason I am trying to do this with mapview - as you have pointed out in your tweets, it makes for a great improvement in user experience when one needs to render large amounts of polygons, which is what I need to do in my shiny app.

kptitov avatar Sep 04 '21 09:09 kptitov

Understood. Unfortunately, my list of things to do is quite long and at this stage the priority is to update {leafgl} first. After that I will get to updating fgb.

tim-salabim avatar Sep 04 '21 09:09 tim-salabim