Javascript Google Maps API DeletedApiProjectMapError
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38199452/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Google Maps API DeletedApiProjectMapError
提问by balintbabics
I have the exact same problem like Arul.
我有与Arul完全相同的问题。
I am trying to use Google Maps API on my webpage but when I try to implement the map I've got DeletedApiProjectMapError.
我正在尝试在我的网页上使用 Google Maps API,但是当我尝试实现地图时,我遇到了 DeletedApiProjectMapError。
First I went to the Error Messagessite after I've tried many ways to include the script, like:
在尝试了多种包含脚本的方法后,我首先访问了错误消息站点,例如:
<script src="http://maps.googleapis.com/maps/api/js?v=3&key=API_KEY"></script>
//or
<script src="http://maps.googleapis.com/maps/api/js?key=API_KEY"></script>
//or
<script src="http://maps.googleapis.com/maps/api/js"></script>
and tried to add new API key
on the Dev site but none of them works.
并尝试API key
在开发站点上添加新内容,但没有一个有效。
Is it possible that the error isn't on my side but on Google's?
错误是否可能不在我这边,而是在 Google 那边?
回答by balintbabics
I have found the solution to the problem.
我已经找到了解决问题的方法。
You need to enable both the Google Maps Javascript API, andthe Geocoding API.
您需要同时启用 Google Maps Javascript API和Geocoding API。
https://console.developers.google.com/projectselector/apis/library
https://console.developers.google.com/projectselector/apis/library
and
和
https://console.developers.google.com/google/maps-apis/apis/geocoding-backend.googleapis.com
https://console.developers.google.com/google/maps-apis/apis/geocoding-backend.googleapis.com
Afterwards the error was RefererNotAllowedMapError
instead of DeletedApiProjectMapError
, but that was because I was running it on localhost - and it worked on the actual site after I added the domain in Credentials -> Domain Verification
.
之后错误是RefererNotAllowedMapError
而不是DeletedApiProjectMapError
,但那是因为我在本地主机上运行它 - 在我添加域后它在Credentials -> Domain Verification
.
回答by Robert Sinclair
Just to add to the reply above with an image (and this solution worked for me while still staying on the local machine), because I was a bit confused about the enabling of APIs part.
只是用一张图片添加到上面的回复中(这个解决方案对我有用,同时仍然留在本地机器上),因为我对 API 部分的启用有点困惑。
Just navigate to: https://console.developers.google.com/projectselector/apis/library
只需导航到:https: //console.developers.google.com/projectselector/apis/library
Select your project (for which you have an API)
选择你的项目(你有一个 API)
On the right side expand the Maps API section and click on "Google Maps Javascript API" and the "Geocoding API"
在右侧展开 Maps API 部分,然后单击“Google Maps Javascript API”和“Geocoding API”
On the page that appears you need to click on the "play" button to enable the API
在出现的页面上,您需要单击“播放”按钮以启用 API
Then you should be good to go without authorizing domains and continue working on the local machine.
那么您应该可以在不授权域的情况下继续工作并继续在本地计算机上工作。