gpt4 book ai didi

r - 传单 map : remove road layer

转载 作者:行者123 更新时间:2023-12-04 03:14:25 26 4
gpt4 key购买 nike

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

示例代码:

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

最佳答案

道路和其他要素是基础 tile 的一部分,或者您可以将其称为“背景”。

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

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

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

关于r - 传单 map : remove road layer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42354903/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com