Reputation: 5497
When using the function get_map()
I receive an error prompting to supply an google-API-key though I use the parameter "source":
location = colMeans(city[,c('coords_x1', 'coords_x2')])#mitte
names(location) <- c('lat', 'lon')
get_map(location = location, source='osm')
note : locations should be specified in the lon/lat format, not lat/lon.
Error: Google now requires an API key.
See ?register_google for details.
It seems as if the parameter is ignored.
Upvotes: 2
Views: 586
Reputation: 5497
The solution lies in the way "location" is used in the query. As long as no bbox
is supplied ggmap will lookup in google for a correct bounding box. Henceforth the error occurs. Thus the following code works:
bbox <- make_bbox(stadt$coords_x1, stadt$coords_x2, f = .05)
map <- get_map(location = bbox, source='osm')
ggmap(map) + geom_point(data=stadt, aes(x=coords_x1, y=coords_x2, color=akaQuote))
Using OSM as a source a bounding box has to be passed to the get_map
function.
Upvotes: 2