增加ggmap的地理编码函数中的api限制(在R中) [英] Increase the api limit in ggmap's geocode function (in R)
问题描述
我试图在 R中的
获取特定位置的坐标。到目前为止,我可以使用这个功能。 ggmaps
库中使用 geocode
函数
我遇到的问题是我想将每日限额从 2,500
增加到 100000
。官方Google 文档
表示,如果您在项目,我很乐意这样做。当您继续此过程时, Google Developers Console
会为您提供个性化的API密钥。
但是, geocode
函数没有选项可放入此个性化API密钥。相反,它要求客户端
(业务用户的客户端ID)和签名
(商业用户的签名), Google Maps API for Work 客户如何访问该API。我知道这也是一种选择,但这似乎是一个非常实用的例子,因为Google Maps API for Work似乎是为大型企业帐户设计的:
$
所以我的问题归结为:每天24小时的100,000个请求我可以使用 gocmaps
函数库中的 geocode
函数 R
ping Google Maps Geocoding API?
我没有找到方法来使用现有的 geocode
函数(来自 ggmap
库)来回答这个问题,所以我创建了一个新函数来自己做这个现有的 getURL
函数(来自 RCurl
库)和 fromJSON
函数(来自 RJSONIO
库)。
编写新函数:
library(RJSONIO)
library(RCurl)
getGeoData< - function(location){
location< - gsub('','+',location)
geo_data< - getURL(粘贴(https://maps.googleapis.com/maps/api/geocode/json?address=,位置,& key = ** [您的Google API API密钥] **,sep = ))
raw_data_2< - fromJSON(geo_data)
return(raw_data_2)
}
测试:
getGeoData(旧金山)
您的列表中包含的数据几乎(但不完全)与 I'm trying to use the The issue I'm running into is that I would like to increase my daily limit from However, the Daily quota starting at 100,000 requests per 24 hours, based on annual contractual purchase. So my question boils down to this: can I use the I didn't find a way to use the existing Write the new function: Test:
This gives you a list with the same data that's almost (but not quite) in the same exact format as the list produced by 这篇关于增加ggmap的地理编码函数中的api限制(在R中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!geocode
function from the ggmaps
library in R
to get coordinates for specific locations. I'm able to use the function fine so far. 2,500
to 100,000
. The official Google documentation
says that this is readily possible if you enable billing on the project, which I'm happy to do. When you proceed with this process, the Google Developers Console
gives you a personalized API key. geocode
function doesn't have an option to put in this personalized API key. Instead, it asks for the client
(client ID for business users) and signature
(signature for business users), which is how Google Maps API for Work customers can access the API. I get that this is also an option, but that seems to be a very use case, since Google Maps API for Work seems to be designed for large enterprise accounts:
geocode
function from the ggmaps
library in R
to ping the Google Maps Geocoding API?geocode
function (from the ggmap
library) to answer this question, so I just created a new function to just do this myself using the existing getURL
function (from the RCurl
library) and the fromJSON
function (from the RJSONIO
library). library(RJSONIO)
library(RCurl)
getGeoData <- function(location){
location <- gsub(' ','+',location)
geo_data <- getURL(paste("https://maps.googleapis.com/maps/api/geocode/json?address=",location,"&key=**[YOUR GOOGLE API KEY HERE]**", sep=""))
raw_data_2 <- fromJSON(geo_data)
return(raw_data_2)
}
getGeoData("San Francisco")
geocode("San Francisco")
.