我刚刚遇到了同样的问题并找到了您的帖子。我可以通过将 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 参数被计划用于其他来源,这将导致问题。我会 ping 包作者。