本文介绍了传单地图:删除道路图层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的R的传单地图中删除道路.有没有办法删除我们想要的图层,例如道路,湖泊,州际边界等?

I want to remove roads from my leaflet map in R. Is there a way to remove layers we want such as roads, lakes, state boundaries, etc.?

示例代码:

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()

推荐答案

道路和其他要素是基本 tile 的一部分,或者您可以将其称为背景".

The roads and other features are part of the base tile, or you can call it 'background'.

默认情况下,图块是OSM的图块,但是您可以使用 addTProviderTiles()函数进行更改,将列出的提供者之一作为参数此处.

By default the tiles are OSM's, but you can change with the addTProviderTiles() function, giving as argument one of the provider listed here.

例如,具有我们的道路或边界的提供商是 Esri.WorldShadedRelief :

For example a provider withour roads or boundaries is Esri.WorldShadedRelief:

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

这篇关于传单地图:删除道路图层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 06:33