简体   繁体   中英

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. Instead of using the generic get_map function, try the specific get_stamenmap like this:

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

Eg,

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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