以下code适用于R但不适用于浏览器。
library(leaflet)
data(quakes)
map = leaflet(data = quakes[1:20,]) %>%
addTiles() %>%
addMarkers(~long, ~lat,
popup = ~as.character(mag), label = ~as.character(mag))
浏览器仅显示标记的位置。我已停用所有浏览器扩展程序。
问题:如何显示基础地图?
会话信息:
R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] leaflet_1.1.0
loaded via a namespace (and not attached):
[1] htmlwidgets_0.8 shiny_1.0.0 magrittr_1.5 R6_2.2.0 htmltools_0.3.5 tools_3.3.3 Rcpp_0.12.10 crosstalk_1.0.0 digest_0.6.12 xtable_1.8-2 httpuv_1.3.3 mime_0.5
答案 0 :(得分:1)
从默认地图图块提供程序获取地图图块时似乎出错。
在传单包中更正之前,我建议使用另一个地图图块提供程序,例如:
map = leaflet(quakes[1:20,]) %>%
addProviderTiles(providers$Esri.NatGeoWorldMap) %>%
addMarkers(~long, ~lat,
popup = ~as.character(mag), label = ~as.character(mag))
map
此处提供了可用地图图块提供商的完整列表:http://leaflet-extras.github.io/leaflet-providers/preview/index.html