为什么我在启用地理编码 API 后仍收到地理编码 API 身份验证错误?
Why I am getting Geocoding API authentication error even after enabling Geocoding API?
我为我的 Google 云平台项目启用了 "Geocoding API"。它仍然给我一个错误:
“地理编码服务:此 API 项目无权使用此 API。有关身份验证和 Google 地图的更多信息 JavaScript API服务请看:https://developers.google.com/maps/documentation/javascript/get-api-key
_.xd @js?libraries=geometry&key=[my_api_key]:79"
我的帐户已启用计费功能,我有一个有效的 Api 密钥和所有其他 API,例如 'Directions service'、Google 映射 javascript api,一切正常。只有地理编码 api 给出错误。我还包含了我尝试使用的示例代码。有人可以帮助我了解我做错了什么或缺少什么吗?
function GetLocation() {
var geocoder = new google.maps.Geocoder();
var address = document.getElementById("txtAddress").value;
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
alert("Latitude: " + latitude + "\nLongitude: " + longitude);
} else {
alert("Request failed.")
}
});
};
更新:此问题已通过取消项目与现有 Cloud Billing 帐户的链接并再次将其链接到活动的结算帐户来解决。 Google 支持团队帮助完成了整个过程。
我为我的 Google 云平台项目启用了 "Geocoding API"。它仍然给我一个错误:
“地理编码服务:此 API 项目无权使用此 API。有关身份验证和 Google 地图的更多信息 JavaScript API服务请看:https://developers.google.com/maps/documentation/javascript/get-api-key _.xd @js?libraries=geometry&key=[my_api_key]:79"
我的帐户已启用计费功能,我有一个有效的 Api 密钥和所有其他 API,例如 'Directions service'、Google 映射 javascript api,一切正常。只有地理编码 api 给出错误。我还包含了我尝试使用的示例代码。有人可以帮助我了解我做错了什么或缺少什么吗?
function GetLocation() {
var geocoder = new google.maps.Geocoder();
var address = document.getElementById("txtAddress").value;
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
alert("Latitude: " + latitude + "\nLongitude: " + longitude);
} else {
alert("Request failed.")
}
});
};
更新:此问题已通过取消项目与现有 Cloud Billing 帐户的链接并再次将其链接到活动的结算帐户来解决。 Google 支持团队帮助完成了整个过程。