Is ggmap broken? Basic qmap() produces “arguments imply differing number of rows: 0,1”

久未见 提交于 2019-12-11 04:13:17

问题


I've used ggmap many times in the past to produce maps with a particular coordinate as the focal point. It has generally been as simple as defining the focal point via the location= argument in qmap(), and adding on geoms to the map as needed.

Today, I opened ggmap for the first time in a while, and it simply is not successful in performing the most basic of mapping tasks.

    devtools::install_github("dkahle/ggmap") #Making sure I'm up-to-date
    library(ggmap)
    qmap(location = "White House", zoom = 14, source = "osm")

Produces the following error:

#Error in data.frame(ll.lat = ll[1], ll.lon = ll[2], ur.lat = ur[1], ur.lon = ur[2])
 : arguments imply differing number of rows: 0, 1

I've been digging around for hours. I tried using get_map() instead, but it produces the same error.

Any ideas?

Update #1

I've gone as far as a clean install of R/RStudio, re-installing packages from a clean slate (devtools, tidyverse, ggmap). Still, the error persists.

Update #2

No luck in getting the location to be automatically geocoded in process of get_map() as I was hoping via ggmap commands.

I've resorted to manually specifying the lat/lon coordinates of the focal point of this map.

qmap(location=c(lon=-77.035,lat=38.897), zoom = 14, source = "google")

Thanks camille for reminding me that there are known issues with the Open Street Map (osm) source (& for generally troubleshooting through this with me).

I've tried on a few different machines, on a few different networks just because it appears that some people have had local network/computer issues at the root of this problem. Now wondering if anyone is able to specify location in qmap() without lat/lon coordinates anymore, or if this problem is unique to me.


回答1:


Updated 2019-04-06:

=============================================

Alternative solution for using ggmap with geocoding, but without the Google API:

library(ggmap)
library(tmaptools)
ggmap(get_stamenmap(rbind(as.numeric(paste(geocode_OSM("Vienna")$bbox))), zoom = 11))



来源:https://stackoverflow.com/questions/52704695/is-ggmap-broken-basic-qmap-produces-arguments-imply-differing-number-of-rows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!