0

默认情况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

感谢你的回答!

4

1 回答 1

0

要隐藏moseCoordinatesdiv,您可以使用以下函数:

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)
}
于 2018-02-20T19:48:54.947 回答