如何在localhost上使用谷歌地图简单的api

dit*_*lav 19 google-maps localhost

我已经在我的网站上请求了一个用于嵌入谷歌地图的链接

https://developers.google.com/maps/documentation/embed/start
Run Code Online (Sandbox Code Playgroud)

并授权每个人都使用链接来使用它

Referers: Any referer allowed
https://code.google.com/apis/console/
Run Code Online (Sandbox Code Playgroud)

但我还是收到了

The Google Maps API server rejected your request. This API project is not authorized 
to use this API. Please ensure that this API is activated in the APIs Console: 
Learn more: https://code.google.com/apis/console
Run Code Online (Sandbox Code Playgroud)

是否有其他方法可以在本地使用嵌入式谷歌地图测试我的网站?

编辑:他们说:

Easy embedding

Google Maps Embed API maps are easy to add to your webpage—just set the URL 
you build as the value of an iframe's src attribute. Control the size of the 
map with the iframe's height and width attributes. No JavaScript required.
Run Code Online (Sandbox Code Playgroud)

但我仍然无法访问该链接.

dit*_*lav 31

问题是他们的"快速启动"已经过时了.

https://developers.google.com/maps/documentation/embed/start

它说你应该只向他们提供你的API密钥,但问题是有一个新版本的同一个网站,他们没有链接到他们的指南,但你得到一个链接到其他地方(我得到的时候提供"结算")

新服务称为云控制台,我在那里找到了API开/关按钮.

https://console.developers.google.com/project/ ...

您必须启用"Static Maps API","Google Maps API"和"Google Maps Embed API",并确保将您的链接放在iframe div中

  • 对我来说,只有在启用"Google Places API Web服务"后才有效 (2认同)

lui*_*uis 8

正如多米尼克所说,请到这里:

https://console.developers.google.com/project/%your-project-name%/apiui/apis/library?q=google%20maps

启用两个API:

  • Google Maps Embed API
  • 静态地图API

然后转到此处:https: //console.developers.google.com/project/%your-project-name%/apiui/credential

  • 创建新密钥
  • 浏览器密钥

而且你已经完成了.