首页
产品
Google Maps Platform
文档
Google Maps Platform 使用入门
本页介绍了在使用 Google Maps Platform 上的任何 API 和 SDK 之前所需要完成的基本步骤。
快速入门
如果您从未用过 Google Cloud 控制台来创建结算账号或项目,点击开始使用按钮即可体验 Cloud 控制台中面向新用户的交互式设置:
开始使用
此外,您还可以点击下方的标签页以完成所需的设置步骤:
第 1 步
控制台
在 Google Cloud 控制台中,打开项目选择器页面,点击创建项目以开始创建新的 Cloud 项目。
前往项目选择器页面
确保您的 Cloud 项目已启用结算功能。确认您的项目已启用结算功能。
注意:虽然您必须设置结算账号才能设置 Cloud 项目,但实际使用 Embed API 时不需要付费。
Google Cloud 提供免费试用。试用期将在 90 天后或者账号费用累积达到 300 美元时(以先到者为准)结束。您随时可以取消试用。Google Maps Platform 每月提供 200 美元的赠金。如需了解详情,请参阅结算账号赠金和结算。
Cloud SDK
gcloud projects create "PROJECT"
您可以详细了解 Google Cloud SDK、Cloud SDK 安装和以下命令:
gcloud projects create
第 2 步
如要使用 Google Maps Platform,您必须启用计划用于项目的 API 或 SDK。
请注意,有些集成需要您启用多个 API/SDK。如果您不确定要启用哪些 API 或 SDK,请尝试使用 API 选择器,或参阅想使用的 API/SDK 对应的文档。
如需启用一个或多个 API/SDK,请执行以下操作:
控制台
前往 Cloud 控制台中的“Maps API 库”页面,查看可启用的 Google Maps Platform API 和 SDK:
前往“Maps API 库”页面
点击您想启用的 API 或 SDK。
如果按钮显示启用,请点击此按钮以启用 API 或 SDK。
如果按钮显示管理,则表示 API 或 SDK 已启用,您无需执行任何其他操作。
点击任一按钮均可显示 API 或 SDK 的信息中心(点击停用按钮可从此项目中移除相应 API 或 SDK)。
Cloud SDK
gcloud services enable \
--project "PROJECT" \
"directions-backend.googleapis.com" \
"distance-matrix-backend.googleapis.com" \
"addressvalidation.googleapis.com" \
"tileaerialview.googleapis.com" \
"airquality.googleapis.com" \
"solar.googleapis.com" \
"elevation-backend.googleapis.com" \
"routes.googleapis.com" \
"geocoding-backend.googleapis.com" \
"geolocation.googleapis.com" \
"maps-android-backend.googleapis.com" \
"maps-backend.googleapis.com" \
"maps-embed-backend.googleapis.com" \
"maps-ios-backend.googleapis.com" \
"places-backend.googleapis.com" \
"pollen.googleapis.com" \
"roads.googleapis.com" \
"routeoptimization.googleapis.com" \
"static-maps-backend.googleapis.com" \
"street-view-image-backend.googleapis.com" \
"timezone-backend.googleapis.com"
您可以详细了解 Google Cloud SDK、Cloud SDK 安装和以下命令:
gcloud services enable
gcloud services disable
注意:启用 Places API 时,也会启用 Maps JavaScript API 地点库、Places SDK for Android 和 Places SDK for iOS。
第 3 步
此步骤仅包含 API 密钥的创建流程。如果您要在生产环境中使用 API 密钥,强烈建议您为该密钥设置限制。如需了解详情,请参阅相应产品的使用 API 密钥页面。
API 密钥是唯一标识符,用于对与您的项目相关联的请求进行身份验证,以便计算使用量和执行结算。您必须至少有一个与您的项目相关联的 API 密钥。
如需创建 API 密钥,请执行以下操作:
控制台
前往 Google Maps Platform > 凭据页面。
前往“凭据”页面
在凭据页面上,依次点击创建凭据 > API 密钥。
已创建的 API 密钥对话框会显示您新创建的 API 密钥。
点击关闭。
新的 API 密钥即会列在凭据页面的 API 密钥下。
(在生产环境中使用 API 密钥之前,请务必为 API 密钥设置限制。)
Cloud SDK
gcloud alpha services api-keys create \
--project "PROJECT" \
--display-name "DISPLAY_NAME"
您可以详细了解 Google Cloud SDK、Cloud SDK 安装和以下命令:
gcloud alpha services api-keys create
结算账号赠金
创建结算账号和项目后,您可以获得 Google Cloud Platform 提供的 300 美元免费试用赠金和 Google Maps Platform 每月定期提供的 200 美元赠金。如需了解详情,请参阅结算账号赠金。
后续步骤
完成设置后,您就可以开始使用 Google Maps Platform API 和 SDK 了。如需了解详情,请参阅您感兴趣的 API 或 SDK 对应的概览、开发者指南和入门指南。我们在 Google Maps Platform 文档(按产品)和 Google Maps Platform API(按平台)中列出了 API 和 SDK。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-07-12。
[null,null,["最后更新时间 (UTC):2024-07-12。"],[[["To start using Google Maps Platform, you must create a billing-enabled Cloud project and enable the desired APIs or SDKs."],["An API key is required to authenticate requests and track usage; it's crucial to restrict your API key for production use."],["Google offers a $300 free trial for Google Cloud Platform and a $200 monthly credit for Google Maps Platform for eligible accounts."],["This guide provides the essential setup steps; for detailed API or SDK usage, refer to the respective documentation."]]],["To begin using Google Maps Platform APIs and SDKs, first, create a new Cloud project and enable billing in the Google Cloud console or via Cloud SDK. Next, enable the desired APIs or SDKs through the Maps API Library page or by using `gcloud services enable`. Finally, create an API key in the Credentials page or using `gcloud services api-keys create`; it is highly recommended to restrict this key before production use. Users are eligible for billing credits.\n"]]