【发布时间】:2017-01-04 18:21:10
【问题描述】:
我在谷歌表格中使用以下脚本:
function reverseGeocode(addressType, lat, lng) {
Utilities.sleep(1500);
if (typeof addressType != 'string') {
throw new Error("addressType should be a string.");
}
if (typeof lat != 'number') {
throw new Error("lat should be a number");
}
if (typeof lng != 'number') {
throw new Error("lng should be a number");
}
var response = Maps.newGeocoder().reverseGeocode(lat, lng),
key = '';
response.results.some(function (result) {
result.address_components.some(function (address_component) {
return address_component.types.some(function (type) {
if (type == addressType) {
key = address_component.long_name;
return true;
}
});
});
});
return key;}
我收到错误消息:一天内调用了太多次服务:地理编码。 (第 24 行)有人知道解决方案吗?
【问题讨论】:
-
为服务付费而不是使用免费版本?您每天免费收到 2500 个请求 - 您做了多少?
-
需要密钥(现在),你是如何输入你的?你用的是真钥匙吗?
-
请在此处发布之前进行最少的研究。错误本身说明出了什么问题,简单的谷歌搜索就会找到答案。
-
@stdunbar 这是您使用密钥的时候。您介意告诉如何在上面的脚本中添加密钥吗?
-
@Umair 上面的代码中没有添加密钥(它不完整)。需要将其添加到对服务的请求中。
标签: google-maps-api-3 google-apps-script google-sheets