I have used this before, and it has worked all the times:
library("ggmap")
newmap2<-get_openstreetmap(bbox = c(left = -71.2612362452596,
bottom = 42.3308503846824, right = -71.0475647202879,
top = 42.4560226746649), scale=80000)
Now, all I can get is the following error message:
In download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") : URL 'http://tile.openstreetmap.org/cgi-bin/export?bbox=-71.2612362452596,42.3308503846824,-71.0475647202879,42.4560226746649&scale=80000&format=png': status was '400 Bad Request'
I have used both the package ggmap v. 2.6.1 (from CRAN) and 2.7 (from GITHUB). Any help is appreciated. G
The process seems to be very resource intensive, and that's why the code doesn't works. Read the discussion here: Updated link: https://help.openstreetmap.org/questions/25637/i-am-receiving-a-blank-page-http11-400-bad-request-after-requesting-a-data-export
Quote from the link:
Background: The export feature needs much processing power, which our servers are short of (just donated resources!). It could be that it works during a low load time
I tried the same location bounding box using "google"
as map source and it worked:
newmap4 <- get_map(location = c(-71.2612362452596,42.3308503846824
,-71.0475647202879,42.4560226746649), source = 'google')
来源:https://stackoverflow.com/questions/41526370/400-bad-request-with-ggmap