R stops displaying maps

92 views Asked by At

Few days ago I was familiarizing myself with displaying maps, plotting points on the map from http://rpubs.com/nickbearman/r-google-map-making

Today, I have intermittent success in displaying maps.

library(ggmap)
map <- qmap('Anaheim', zoom = 10, maptype = 'roadmap')

Outputs

Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=Anaheim&zoom=10&size=640x640&scale=2&maptype=roadmap&language=en-EN&sensor=false

And when I go to the URL [http://maps.googleapis.com/maps/api/staticmap?center=Anaheim&zoom=10&size=640x640&scale=2&maptype=roadmap&language=en-EN&sensor=false], it displays fine

Then I restarted R Studio and when I loaded ggmap and wanted to see map of Liverpool, it loaded, then I queried map of Anaheim and after few moments it also loaded.

library(ggmap)
qmap('Liverpool')
qmap('Anaheim')

How to make sure maps load as expected?

1

There are 1 answers

0
romants On BEST ANSWER

You are just saving a map into variable and not displaying it. Just do

library(ggmap)
map <- qmap('Anaheim', zoom = 10, maptype = 'roadmap')
map

Or

library(ggmap)
qmap('Anaheim', zoom = 10, maptype = 'roadmap')