默认情况下,在mapview
中,鼠标光标和投影信息显示在地图顶部的框中。
如何隐藏此信息框,默认情况下是leaflet
?
library(leaflet)
library(mapview)
leaflet(data = breweries) %>%
addTiles() %>%
addCircleMarkers()
第二,是否可以选择显示leaflet
中的基本样式?
leaflet(data = breweries) %>%
addTiles() %>%
addCircleMarkers() %>%
addMouseCoordinates(style = "basic")
我试图这样做,但无法找到解决方案:
library(mapview)
m <- mapview(breweries)
m@map <- m@map %>%
addMouseCoordinates(style = "basic")
m
感谢您的回答!
答案 0 :(得分:0)
要隐藏moseCoordinates
div,您可以使用以下功能:
removeMouseCoordinates = function(map) {
if (inherits(map, "mapview")) map = mapview2leaflet(map)
rc = map$jsHooks$render
rc_lnlt = lapply(rc, grep, pattern = "lnlt")
for (i in seq_along(map$jsHooks$render)) {
map$jsHooks$render[[i]][rc_lnlt[[i]]] = NULL
}
return(map)
}