2014-11-01 53 views
19

簡單的API,我要求的鏈接上如何使用谷歌地圖本地主機上

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. 

,但我仍然無法訪問的鏈接。

+4

激活Google Maps Embed API服務。 – HaveNoDisplayName 2014-11-01 22:54:12

+2

並且還要確保啓用「靜態地圖API」服務也可以使用「Google Maps API」服務 – HaveNoDisplayName 2014-11-01 22:58:55

+0

可能的重複[如何設置Google API密鑰限制 - HTTP引用者](https://stackoverflow.com/questions/41993276/) how-to-set-google-api-key-restriction-http-referrers) – viktorianer 2018-01-26 14:39:56

回答

31

問題是他們的「快速入門」已過時。

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

它說,你應該只向他們提供您的API密鑰,但事情是,有同一個網站的一個新版本,他們沒有聯繫,從他們的指導,但你得到一個鏈接到其他地方(我在「結算」時獲得)

新服務被稱爲雲控制檯,我在那裏找到API開/關按鈕。

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

您必須啓用「靜態地圖API」,「谷歌地圖API」和「谷歌地圖API嵌入」,並確保有一個IFRAME DIV你的鏈接

+1

這裏對我來說關鍵是打開靜態地圖API,儘管我沒有想到我正在使用它(我只有Google Maps Embed API啓用)。一旦我打開靜態API,一切都開始起作用。 – Joshua 2015-03-18 13:11:05

+2

對我來說,它只有在啓用'Google Places API Web服務'後才起作用 – mdev 2015-05-04 18:06:01

8

正如多米尼克說,去這裏:

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

啓用這兩個API:

  • 谷歌地圖API嵌入
  • 靜態地圖API

然後去這裏: https://console.developers.google.com/project/%your-project-name%/apiui/credential

  • 創建新密鑰
  • 瀏覽器主要

大功告成。

+1

對我而言,localhost與Browser Key一起工作,謝謝! – Max 2016-08-30 12:06:12

+0

不工作:(blaah – 2017-03-07 05:06:38

+0

這是從2015年6月的答案,我們在2017年三月 這就像froogaloop的整合與VIMEO的API, 老。 此致基尚公認的答案。 – Luis 2017-03-07 19:31:53

0

我還必須啓用Google Maps JavaScript API。