简体   繁体   English

如何从ggmap获取黑白地图?

[英]How to get a black and white map from ggmap?

If I use a state name as the first argument like so:如果我使用状态名称作为第一个参数,如下所示:

map <- ggmap::get_map("Louisiana", zoom=3, maptype = "toner-background", source="stamen")

then I get the black and white map that I want like so:然后我得到了我想要的黑白地图:

在此处输入图片说明

But If I enter the first argument with longitude and latitude coordinates like so:但是,如果我输入第一个参数的经度和纬度坐标,如下所示:

map <- ggmap::get_map(c(left=-120, bottom=-65, right=5, top=70), zoom = 3, maptype = "toner-background", source="stamen")

Then i always get a map like this:然后我总是得到这样的地图:

在此处输入图片说明

The other parameters seem to have no effect.其他参数似乎没有影响。

My goal is to call this function with coordinates like the second line of code and get a black and white map like in the first case.我的目标是像第二行代码一样使用坐标调用这个函数,并像第一种情况一样获得黑白地图。

This issue of getting a Google Terrain map when you wanted a Stamen map is one that I saw recently in another context.当您需要雄蕊地图时获取 Google 地形地图的问题是我最近在另一种情况下看到的问题。 Instead of using the generic get_map function, try the specific get_stamenmap like this:不要使用通用的get_map函数, get_stamenmap像这样尝试特定的get_stamenmap

library(ggmap)

ggmap(get_stamenmap(c(left=-120, bottom=-65, right=5, top=70), zoom = 3, 
                    maptype = "toner-background"))

在此处输入图片说明

If you've already downloaded the colored images, you have to use force = TRUE argument如果您已经下载了彩色图像,则必须使用force = TRUE参数

Eg,例如,

map = get_stamenmap(your-map, maptype = "toner-background", color="bw", force=T) map = get_stamenmap(your-map, maptype = "toner-background", color="bw", force=T)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM