简体   繁体   中英

ggmap in r - own bounding box

I am trying to make a map with my own borders of bounding box. But so far I failed every time.

First I tried to do it with function get_map . Here I found that I need to specify source = "osm" . My code had been

 my_map<-get_map(location=c(-15, 30, 15, 85), source="osm")

but I recieved an error

 Error: map grabbing failed - see details in ?get_openstreetmap.
 In addition: Warning message:
 In download.file(url, destfile = destfile, quiet = !messaging, mode = "wb")      :
   cannot open: HTTP status was '0 (nil)'`

Than I tried using get_openstreetmap . My code was

  get_openstreetmap(bbox = c(left = -15.00000, bottom = 29.38048, right = 15.00000,
  top=85.00000, scale=606250))

but again I got an error

 Error: bounding box improperly specified.  see ?get_openstreetmap

Although I read both ?get_openstreetmap and ?get_map I dont know what I am doing wrong. Can anyone help me? Please consider that after getting a map I will need to add some points on it, so just url isn't enough for me.

Thx a lot!

Couple of issues here. You have a typo thats including scale in your bounding box for the get_openstreetmap function, causing the error.

get_openstreetmap(bbox = c(left = -15.00000, bottom = 29.38048, right = 15.00000,
  top=85.00000), scale=606250)

Second the scale you're trying to download appears to be to small for the region your downloading. Try increasing the scale.

help(OSM_scale_lookup)

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