bill999
bill999

Reputation: 2560

Wrong type of map when using ggmap and get_map

When I get a map using the watercolor option using this code:

ggmap(get_map(location=c(x = -97, y = 37), zoom = 4, maptype='watercolor')) 

It gives the following text in red:

maptype = "watercolor" is only available with source = "stamen".
resetting to source = "stamen"...

But it still works. In other words, it uses the watercolor option.

However, when I do something slightly different—specify the exact location:

ggmap(get_map(location=c(-123, 25, -70, 48), maptype='watercolor'))

Then it gives this message:

maptype = "watercolor" is only available with source = "stamen".
resetting to source = "stamen"...

And, importantly, it does NOT use the watercolor option, but reverts to something else. What can I do to use this latter version but still get the option that I want?

Upvotes: 1

Views: 476

Answers (1)

Gregory
Gregory

Reputation: 4279

I think the issue has something to do with get_map(location(... calling Google for the location. Using get_stamenmap seems to alleviate that issue, but the syntax is slightly different in that it requires a bounding box (which you already provided) for the location.

Is this what you're wanting it to do?

library(ggmap)

ggmap(get_stamenmap(bbox=c(-123, 25, -70, 48), zoom = 5, 
              maptype='watercolor'))

enter image description here

Upvotes: 1

Related Questions