如何获取 Google 地图 API 密钥

有关如何获取 API 密钥的完整教程,请参阅此处的 Google 官方文档: https://developers.google.com/maps/documentation/javascript/get-api-key

创建 Google API 密钥

在你的, 谷歌云平台 导航至 API 和服务以查找您的凭证。单击“创建凭据”按钮后可以创建新的 API 密钥,该选择为您提供“API 密钥”选项。

我们强烈建议您注意限制。您应该使用 HTTP Referrers 限制您的 API 密钥 仅有的 对于将使用 Google 地图 API 密钥的网站。这样一来,其他人就无法窃取和使用您的 API 密钥。

启用库

我需要哪些 API?

由于 Google 没有明确说明您需要激活哪些 API,因此以下是所有 Google 地图功能所需的 API 列表:

  • 谷歌地图路线
  • 谷歌地图距离矩阵
  • 谷歌地图海拔
  • 谷歌地图地理编码
  • 谷歌地图 JavaScript

您必须在“库”部分启用这些 API。

将 API 密钥保存在 Citadela Listing 插件中

在哪里插入我的 API 密钥?如果您以管理员身份登录 WordPress,则可以在 Citadela Listing -> 集成中插入 API 密钥

Debugging issues

If you encounter any issues with your Google Maps API key, you can easily debug them using the Console in your browser. To open the Console, simply right-click anywhere on the webpage, select “Inspect” or “Inspect Element,” then navigate to the “Console” tab. Here, you’ll find error messages and warnings that can help identify and resolve any issues with your API key configuration. Keep an eye out for any error messages related to the Google Maps API, and use them as clues to troubleshoot and fix the problem.