外部传单地图闪亮

问题描述 投票:1回答:1

我正在设置一个闪亮的应用程序,并希望包括这张地图:https://openweathermap.org/weathermap?basemap=map&cities=true&layer=temperature&lat=47&lon=1&zoom=6

r shiny leaflet openweathermap
1个回答
1
投票

幸运的传单让你可以提供彩虹般的瓷砖。要检查哪些可用于OpenWeatherMap,请尝试

library(leaflet)
> names(providers)[grepl("OpenWeatherMap", names(providers))]
 [1] "OpenWeatherMap"                      "OpenWeatherMap.Clouds"               "OpenWeatherMap.CloudsClassic"       
 [4] "OpenWeatherMap.Precipitation"        "OpenWeatherMap.PrecipitationClassic" "OpenWeatherMap.Rain"                
 [7] "OpenWeatherMap.RainClassic"          "OpenWeatherMap.Pressure"             "OpenWeatherMap.PressureContour"     
[10] "OpenWeatherMap.Wind"                 "OpenWeatherMap.Temperature"          "OpenWeatherMap.Snow" 

所以,你可以调出你的温度图。请注意,您需要在服务网站上申请API密钥(来自here)。

leaflet() %>%
  addTiles() %>%
  addProviderTiles(providers$OpenWeatherMap.Temperature,
                   options = providerTileOptions(apiKey="<your_api_key_here>")) %>%
  setView(14.4220129, 46.0846989, zoom = 6)

但是,不知道如何整合城市层。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.