如何在本地主机上使用谷歌地图简单 api [英] How to use google maps simple api on localhost
问题描述
我已请求在我的网站上嵌入谷歌地图的链接
I have requested a link for embedding google maps on my website on
https://developers.google.com/maps/documentation/embed/start
并已授权所有知道该链接的人使用它
and have authorized everyone with the link to use it
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
还有其他方法可以使用嵌入式谷歌地图在本地测试我的网站吗?
Is there some other way to test my website locally with embedded google maps?
他们说:
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.
但我仍然无法访问链接.
but I still can't access the link.
推荐答案
问题是他们的快速入门"已经过时了.
The problem was that they have their "quick start" out of date.
https://developers.google.com/maps/documentation/embed/start
它说你应该只向他们提供你的 API 密钥,但问题是同一网站有一个新版本,他们没有从他们的指南中获得链接,但你可以从其他地方获得链接(我得到了在计费"时提供)
It says you should only provide them with your API key but the thing is that there is a new version of the same website which they don't have links to from their guide but which you get a link to elsewhere( I got offered when in "billing" )
新服务称为 Cloud Console,我在那里找到了 API 开/关按钮.
The new service is called Cloud Console and I found the API on/off buttons there.
https://console.developers.google.com/project/...
您必须启用Static Maps API"、Google Maps API"和Google Maps Embed API",并确保您的链接在 iframe div 中
You have to enable the "Static Maps API", "Google Maps API" and "Google Maps Embed API" and make sure to have your link in an iframe div
这篇关于如何在本地主机上使用谷歌地图简单 api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!