2017-02-20 95 views
1

我想从我的小册子地图中删除道路。有没有办法去除我们想要的图层,如道路,湖泊,州界线等?小册子地图:删除道路图层

示例代码:

library(leaflet) 
library(plot3D) 
top = 45  # north lat 
left = -110 # west long 
right = -90 # east long 
bottom = 32 # south lat 

longitudes= seq(left,right, length.out = 3) 
latitude=seq(bottom,top,length.out = 5) 

latlons_mesh=mesh(longitudes,latitude) 

longitude=as.vector(latlons_mesh$x) 
latitude=as.vector(latlons_mesh$y) 

mydata=data.frame(longitude=longitude, 
        latitude=latitude) 

leaflet(mydata)%>%fitBounds(right,bottom,left,top)%>% 
    addTiles()%>% 
    addMarkers() 

enter image description here

回答

1

的道路和其他功能的基础tile的一部分,或者可以称之为 '背景'。

默认情况下,磁贴是OSM的,但您可以使用addTProviderTiles()函数进行更改,作为参数提供者之一列出here

例如一个提供商全无道路或边界是Esri.WorldShadedRelief

leaflet(mydata) %>% 
    fitBounds(right,bottom,left,top)%>% 
    addProviderTiles('Esri.WorldShadedRelief') %>% 
    addMarkers()