gpt4 book ai didi

r - 向 RgoogleMaps 图添加点

转载 作者:行者123 更新时间:2023-12-01 12:38:27 27 4
gpt4 key购买 nike

我正在使用 R 的包 RgoogleMaps。我已经绘制了我的 map ,我需要使用 points 命令添加点,但它不起作用.这是我的代码:

PlotOnStaticMap(Map, add = FALSE, TrueProj=F,  FUN = points)    # plot the background

# add external boundary

for (nb in 1:100)
{
points(x[nb],y[nb],type="l",lwd=3)
}

我该如何解决?

最佳答案

我想这就是您要找的:

lat = c(40.702147,40.718217,40.711614);
lon = c(-74.012318,-74.015794,-73.998284);
center = c(mean(lat), mean(lon));
zoom <- min(MaxZoom(range(lat), range(lon)));


Map <- GetMap(center=center, zoom=zoom,markers = paste0("&markers=color:blue|label:S|",
"40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318&markers=",
"color:red|color:red|label:C|40.718217,-73.998284"), destfile = "MyTile1.png");





tmp <- PlotOnStaticMap(Map, lat = c(40.702147,40.711614,40.718217),
lon = c(-74.015794,-74.012318,-73.998284),
destfile = "MyTile1.png", cex=1.5,pch=20,
col=c('red', 'blue', 'green'), add=FALSE);


# Now let's add points with the points method:

PlotOnStaticMap(Map, lat = c(40.702147,40.711614,40.718217),
lon = c(-74.015794,-74.012318,-73.998284),
lwd=1.5,col=c('red', 'blue', 'green'), points(x = 40.702148, y = NULL ), add=TRUE)

查看 PlotOnStaticMappoints() 的语法?

关于r - 向 RgoogleMaps 图添加点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27360265/

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