【问题标题】:How to use google maps simple api on localhost如何在本地主机上使用谷歌地图简单 api
【发布时间】:2014-12-28 22:00:58
【问题描述】:

我已请求在我的网站上嵌入谷歌地图的链接

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

并已授权所有知道链接的人使用它

Referers: Any referer allowed
https://code.google.com/apis/console/

但我仍然收到一个

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

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

编辑: 他们说:

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.

但我仍然无法访问链接。

【问题讨论】:

标签: google-maps localhost


【解决方案1】:

问题是他们的“快速入门”已经过时了。

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

它说您应该只向他们提供您的 API 密钥,但问题是同一网站有一个新版本,他们没有从他们的指南中获得链接,但您可以从其他地方获得链接(我得到了在“计费”时提供)

新服务称为 Cloud Console,我在那里找到了 API 开/关按钮。

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

您必须启用“Static Maps API”、“Google Maps API”和“Google Maps Embed API”,并确保您的链接位于 iframe div 中

【讨论】:

  • 对我来说关键是打开静态地图 API,尽管我认为我没有使用它(我只启用了 Google Maps Embed API)。一旦我打开了静态 API,一切都开始运转了。
  • 对我来说,它只有在启用“Google Places API Web Service”后才有效
【解决方案2】:

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

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

启用两个 API:

  • Google 地图嵌入 API
  • 静态地图 API

然后去这里: https://console.developers.google.com/project/%your-project-name%/apiui/credential

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

你已经完成了。

【讨论】:

  • 这是 2015 年 6 月的答案,我们是 2017 年 3 月。这就像 froogaloop 与 vimeo 的 api 集成的公认答案,旧的。最好的问候基尚。
【解决方案3】:

我还必须启用 Google Maps JavaScript API。

【讨论】:

    猜你喜欢
    • 2016-12-02
    • 1970-01-01
    • 1970-01-01
    • 2015-01-14
    • 2017-03-10
    • 1970-01-01
    • 1970-01-01
    • 2012-01-02
    • 1970-01-01
    相关资源
    最近更新 更多