我正在尝试使用R库Ggmap对载体进行地理定位。
location_google_10000 <- geocode(first10000_string, output = "latlon",
source = "dsk", messaging = FALSE)
问题是我正在使用&#34; dsk&#34; - 数据科学工具包API-因此它没有速率限制为谷歌(限制为每天2500坐标)。但是,当我尝试使用包含超过2500的向量运行时,会弹出以下消息:
Error: google restricts requests to 2500 requests a day for non-business use.
我尝试使用带有1000个地址的dsk运行代码,然后检查是否实际使用了google或dsk api:
> geocodeQueryCheck()
2500 geocoding queries remaining.
因此,由于某种原因,它不允许我使用&#34; dsk&#34;超过2500,但我确信它不使用谷歌。
答案 0 :(得分:5)
我刚遇到同样的问题,发现了你的帖子。我能够通过将client
和signature
值设置为虚拟值来解决此问题,例如
geocode(myLocations, client = "123", signature = "123", output = 'latlon', source = 'dsk')
问题似乎出现在地理编码功能的这一部分......
if (length(location) > 1) {
if (userType == "free") {
limit <- "2500"
}
else if (userType == "business") {
limit <- "100000"
}
s <- paste("google restricts requests to", limit, "requests a day for non-business use.")
if (length(location) > as.numeric(limit))
stop(s, call. = F)
userType
在代码的这一部分中设置如上...
if (client != "" && signature != "") {
if (substr(client, 1, 4) != "gme-")
client <- paste("gme-", client, sep = "")
userType <- "business"
}
else if (client == "" && signature != "") {
stop("if signature argument is specified, client must be as well.",
call. = FALSE)
}
else if (client != "" && signature == "") {
stop("if client argument is specified, signature must be as well.",
call. = FALSE)
}
else {
userType <- "free"
}
因此,如果client
和signature
参数为空userType
设置为“空闲”,则限制设置为2,500。通过为这些参数提供值,您将被视为“业务”用户,其限制为100,000。如果假设用户使用'Google'而不是'dsk'作为源,这是一个很好的检查,但如果源是'dsk'并且应该被覆盖则过于热心。简单的想法可能就像......
if (source == "google") {
if (client != "" && signature != "") {
if (substr(client, 1, 4) != "gme-")
client <- paste("gme-", client, sep = "")
userType <- "business"
}
else if (client == "" && signature != "") {
stop("if signature argument is specified, client must be as well.",
call. = FALSE)
}
else if (client != "" && signature == "") {
stop("if client argument is specified, signature must be as well.",
call. = FALSE)
}
else {
userType <- "free"
}
} else {
userType <- "business"
}
如果为其他来源计划了client
或signature
参数,那么这会导致问题。我会打包包作者。