在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
leaflet包里面,内置了多个基础地图,包括了OpenStreetMap、Esri和CartoDB等等。还可以加载自定义的WMTS,当然,有些地图是需要 F-Q 的。 设置底图的方法是: addProviderTiles("地图标号") 默认用的osm。 下面是虾神找到的,可以直接在leaflet包中直接加载的地图标号(不用 F-Q 啊!再一次热泪盈眶) ############################### # OpenStreetMap.Mapnik # OpenStreetMap.BlackAndWhite # OpenStreetMap.DE # OpenStreetMap.France # OpenStreetMap.HOT # OpenTopoMap # Thunderforest.OpenCycleMap # Thunderforest.Transport # Thunderforest.TransportDark # Thunderforest.SpinalMap # Thunderforest.Landscape # Thunderforest.Outdoors # Thunderforest.Pioneer # OpenMapSurfer.Roads # OpenMapSurfer.Grayscale # Hydda.Full # Stamen.Toner # Stamen.TonerBackground # Stamen.TonerLite # Stamen.Watercolor # Stamen.Terrain # Stamen.TerrainBackground # Stamen.TopOSMRelief # Esri.WorldStreetMap # Esri.DeLorme # Esri.WorldTopoMap # Esri.WorldImagery # Esri.WorldTerrain # Esri.WorldShadedRelief # Esri.WorldPhysical # Esri.OceanBasemap # Esri.NatGeoWorldMap # Esri.WorldGrayCanvas # MtbMap # CartoDB.Positron # CartoDB.PositronNoLabels # CartoDB.PositronOnlyLabels # CartoDB.DarkMatter # CartoDB.DarkMatterNoLabels # CartoDB.DarkMatterOnlyLabels # HikeBike.HikeBike # HikeBike.HillShading # NASAGIBS.ModisTerraTrueColorCR # NASAGIBS.ModisTerraBands367CR # NASAGIBS.ViirsEarthAtNight2012 # NASAGIBS.ModisTerraLSTDay # NASAGIBS.ModisTerraSnowCover # NASAGIBS.ModisTerraAOD # NASAGIBS.ModisTerraChlorophyll ################################################# 挑几个来看看,首先挑Esri提供的四个地图: leaflet()%>%setView(lng=116.38,lat=39.9,zoom=3)%>% addTiles()%>%addProviderTiles("Esri.WorldStreetMap") addTiles()%>%addProviderTiles("Esri.WorldImagery") addTiles()%>%addProviderTiles("Esri.WorldTerrain") addTiles()%>%addProviderTiles("Esri.NatGeoWorldMap") 加载NASA提供的2012年全球灯光夜景数据: leaflet()%>%setView(lng=116.38,lat=39.9,zoom=2)%>% addTiles()%>%addProviderTiles("NASAGIBS.ViirsEarthAtNight2012") 加载2015年1月15日、5月15日和8月15日和11月15日的modis数据: leaflet() %>% setView(lng = 110, lat = 30, zoom = 2) %>% addTiles() %>% addProviderTiles("NASAGIBS.ModisTerraTrueColorCR", options = providerTileOptions( time = "2015-01-15", opacity = 1)) setView(lng = 110, lat = 30, zoom = 2) %>% addTiles() %>% addProviderTiles("NASAGIBS.ModisTerraTrueColorCR", options = providerTileOptions( time = "2015-05-15", opacity = 1)) leaflet() %>% setView(lng = 110, lat = 30, zoom = 2) %>% addTiles() %>% addProviderTiles("NASAGIBS.ModisTerraTrueColorCR", options = providerTileOptions( time = "2015-08-15", opacity = 1)) setView(lng = 110, lat = 30, zoom = 2) %>% addTiles() %>% addProviderTiles("NASAGIBS.ModisTerraTrueColorCR", options = providerTileOptions( time = "2015-11-15", opacity = 1)) 当然,还可以加载自己的WMS服务,不过鉴于国内WMS服务实在不好找,找到的又实在不好用,所以这里用官方的示例: leaflet() %>% addTiles() %>% setView(-93.65, 42.0285, zoom = 4) %>% addWMSTiles( "http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", layers = "nexrad-n0r-900913", options = WMSTileOptions(format = "image/png", transparent = TRUE), attribution = "Weather data ? 2012 IEM Nexrad" ) 待续未完。 |
请发表评论