我正在尝试使用R库Ggmap对矢量进行地理定位。
location_google_10000 <- geocode(first10000_string, output = "latlon",
source = "dsk", messaging = FALSE)问题是,我使用的是"dsk“-The数据科学工具包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.因此,出于某种原因,它不允许我使用超过2500的"dsk",但我确定它不使用谷歌。
发布于 2017-03-05 11:29:36
我刚刚遇到了同样的问题,找到了你的帖子。我可以通过将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包的作者。
https://stackoverflow.com/questions/42282492
复制相似问题