我使用谷歌地图API来获取geoocode
财富500强企业的坐标但是,当我运行它时,它仍然会定期显示OVER_QUERY_LIMIT
因此我的地理编码列表不完整。所以我有两个问题:
获得Fortune500名单:
library(XML)
library(RCurl)
fortune500_url <- getURL("https://www.geolounge.com/fortune-500-list-by-
state-for-2015/",.opts = list(ssl.verifypeer = FALSE) )
fortune500 = readHTMLTable(fortune500_url, header = TRUE, which = 1)
colnames(fortune500) <- tolower(colnames(fortune500))
fortune500 <-
subset(fortune500,select=c("company","streetadd","place","state","zip"))
write.csv(fortune500, "fortune500.csv")
无法获得以下所有Fortune500公司的坐标:
# Add API key to renviron file
usethis::edit_r_environ() # how do we assign API key to a variable?
# Install Developer version of ggmap to use maps API Key
devtools::install_github("dkahle/ggmap")
library(ggmap)
register_google(key = Sys.getenv("MY_API_KEY")) # how to source my key from R environment ?
fortune500$address <- paste(fortune500$streetadd, fortune500$place,
fortune500$state, fortune500$zip)
geocodes <- geocode(fortune500$address, output = "latlon" , source =
"google") # can't get all coordinates
感谢您的帮助。