本产品或功能目前处于旧版状态。如需详细了解“旧版”状态以及如何从旧版服务迁移到较新的服务,请参阅
旧版产品和功能。
设置您的 Google Cloud 项目
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本指南介绍了如何在使用 Google Maps Platform API 之前设置 Google Cloud 项目。尽管您可能已经完成了快速入门或 Google Maps Platform 使用入门页面中的部分步骤,但本文档提供了更多有关管理项目的实用说明。
创建项目
如要使用 Google Maps Platform,您必须拥有一个项目,以便管理服务、凭据、结算、API 和 SDK。
您需要对每个项目设置结算功能,但只有当项目超过免费服务的配额时才需要付费。
如要创建启用了结算功能的 Cloud 项目,请按以下步骤操作:
控制台
-
在 Cloud 控制台中创建新的 Google Cloud 项目:
创建新项目
-
在新建项目页面上,填入必填信息:
-
项目名称:使用默认名称或输入自定义名称。
您可以随时更改项目名称。如需了解详情,请参阅标识项目。
-
项目 ID:接受默认 ID,或点击修改以输入自定义 ID(Google API 会将该 ID 用作您项目的唯一标识符)。
创建项目后,您便无法更改项目 ID,因此请选择一个您在项目生命周期内可以安心使用的 ID。请勿在项目 ID 中包含任何敏感信息。
-
结算账号:为项目选择结算账号。如果您尚未设置结算账号或只有一个结算账号,则不会看到此选项。
您必须是 Billing Account Administrator 或 Project Billing Manager,才能将项目与结算账号相关联。如需了解详情,请参阅结算账号访问权限控制文档。
-
位置:如果您想将项目关联到某个组织,请点击浏览并选择相应组织;否则,请选择“无组织”。
如需了解详情,请参阅创建和管理文件夹以及组织、项目和结算账号之间的关系。
选择创建。
启用结算功能
如要部署应用,您必须启用结算功能。只要不超过每月配额,我们便不会向您的账号收取费用。如果您的应用需要的资源超过每月配额,则您需要为额外用量支付费用。
如果您在创建 Cloud 项目时已拥有结算账号,则该项目会自动启用结算功能。
如需对 Cloud 项目启用结算功能,请执行以下操作:
- 在 Cloud 控制台中,前往“结算”页面:
前往“结算”页面
- 选择或创建 Cloud 项目。
- 根据是否存在结算账号或者所选 Cloud 项目是否与结算账号关联,“结算”页面会显示以下某项:
- 如果所选 Cloud 项目已启用结算功能,则页面将显示结算账号的相关详情。
- 如果没有结算账号,系统会提示您创建结算账号并将其与所选 Cloud 项目关联。
- 如果已存在结算账号,但所选 Cloud 项目尚未与结算账号关联,系统会提示您启用结算功能。您还可以选择取消,然后选择创建账号,以创建并关联新的结算账号。
启用结算功能后,向您收取的费用金额将不设上限。为了更好地控制费用,您可以创建预算并设置提醒。如需了解详情,请参阅结算。
启用 API
如要使用 Google Maps Platform,您必须启用计划用于项目的 API 或 SDK。
查看已启用的 API
控制台
如要查看您已启用的 API 或 SDK,请前往 Cloud 控制台中的 Google Maps Platform 页面:
前往 Google Maps Platform 页面
- 其他 API:这些 API 或 SDK 未启用。
- 如果您看到的是各个 Maps API 和服务所对应的卡片,则表明尚未启用任何 API 或 SDK。
关停项目
您可以通过关停项目来停用结算功能并释放该 Cloud 项目中使用的所有 Cloud 资源:
后续步骤
设置 Google Cloud 项目后,您必须创建并妥善保管 API 密钥,才能使用 Directions API:
使用 API 密钥
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eThis guide provides instructions on setting up a Google Cloud project to use with Google Maps Platform APIs, including billing and API enablement.\u003c/p\u003e\n"],["\u003cp\u003eBefore using Google Maps Platform APIs, you must create a Cloud project, enable billing, and enable the specific APIs you need.\u003c/p\u003e\n"],["\u003cp\u003eAlthough billing setup is required, you are only charged if your project usage surpasses the free tier quota.\u003c/p\u003e\n"],["\u003cp\u003eProjects can be shut down to disable billing and release Cloud resources when they are no longer needed.\u003c/p\u003e\n"],["\u003cp\u003eAfter project setup, you'll need to create and secure an API key for using the Google Maps Platform APIs.\u003c/p\u003e\n"]]],["To use Google Maps Platform, you must first create a Google Cloud project, defining its name, ID, billing account, and organization. Billing must be enabled, though you're only charged if your usage exceeds the monthly quota. You also need to enable specific APIs or SDKs through the console or Cloud SDK. You can view enabled APIs, or shut down projects to disable billing and release resources, by using the console or command line. Then, you need to create and secure an API key.\n"],null,["# Set up your Google Cloud project\n\nThis guide shows how to set up your Google Cloud project before using\nthe Google Maps Platform APIs. While you may have completed some of these\nsteps in the\n[Quickstart](/maps/documentation/directions/quickstart)\nor\n[Getting started with Google Maps Platform](/maps/get-started) page,\nthis document provides additional, useful instructions for managing your projects.\n\nCreate a project\n----------------\n\nTo use Google Maps Platform, you must have a project to manage services,\ncredentials, billing, APIs, and SDKs.\n\n[Billing setup](#billing) is required for each project, but you will only be charged if a\nproject exceeds its [quota](/maps/billing-and-pricing/billing#monthly-credit) of no-charge services.\n\nTo create a Cloud project with billing enabled: \n\n### Console\n\n1. Create a new Google Cloud project in the Cloud console:\n\n [Create new project](https://console.cloud.google.com/projectcreate?utm_source=Docs_NewProject&utm_content=Docs_directions-backend)\n2. On the **New Project** page, fill in the required information:\n\n - **Project name:** Accept the default or enter a customized name.\n\n You can change the project name at any time. For more information, see\n [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects).\n - **Project ID:** Accept the default or click **EDIT** to enter a\n customized ID that Google APIs use as a unique identifier for your project.\n\n After you create the project, you *cannot* change the project ID, so\n choose an ID that you'll be comfortable using for the lifetime of the\n project. Don't include any sensitive information in your project ID.\n - **Billing account:** Select a billing account for the project. If you\n haven't set up a billing account or only have one billing account, you\n won't see this option.\n\n You must be a Billing Account Administrator or Project Billing Manager\n to associate a project with a billing account. For more information, see\n [the billing access control documentation](https://cloud.google.com/billing/docs/how-to/billing-access#overview_of_billing_roles_in).\n - **Location:** If you have an organization you want to link your project\n to, click **Browse** and select it; otherwise, choose \"No organization\".\n\n For more information, see [Creating and Managing Folders](https://cloud.google.com/resource-manager/docs/creating-managing-folders)\n and [Relationships between organizations, projects, and billing accounts](https://cloud.google.com/billing/docs/how-to/billing-access#relationships-between-resources).\n3. Select **Create**.\n\n### gcloud\n\n```bash\ngcloud projects create \"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\"\n```\n\nRead more about the\n[Google Cloud SDK](https://cloud.google.com/sdk)\n,\n[Cloud SDK installation](https://cloud.google.com/sdk/docs/install)\n, and the following commands:\n\n- [`gcloud projects create`](https://cloud.google.com/sdk/gcloud/reference/projects/create)\n\nEnable billing\n--------------\n\nTo deploy your apps, you must enable billing. Your account won't be charged\nif you stay within your [monthly quota](/maps/billing-and-pricing/billing#monthly-credit).\nIf your application needs resources that exceed the monthly quota, you will be\ncharged for the additional usage.\n\nIf you have a billing account when you create a Cloud\nproject, then billing is automatically enabled on that project.\n\nTo enable billing on a Cloud project:\n\n1. In the Cloud console, go to the Billing page: \n [Go to the Billing page](https://console.cloud.google.com/projectselector/billing?utm_source=Docs_Billing&utm_content=Docs_directions-backend)\n2. Select or create a Cloud project.\n3. Depending on if a billing account exists or if the selected Cloud project is associated with an account, the Billing page displays one of the following:\n - If billing is already enabled for the selected Cloud project, then the details about the billing account are listed.\n - If no billing account exists, you are prompted to create a billing account and associate it with the selected Cloud project.\n - If a billing account exists, you are prompted to enable billing if the selected Cloud project is not already associated with a billing account. You can also select **Cancel** and then select **Create account** to create and associate a new billing account.\n\nAfter you enable billing, there is no limit to the amount that you might\nbe charged. To gain more control over your costs, you can\n[create\na budget and set alerts](/maps/billing-and-pricing/billing#creating-budgets-and-set-alerts). For more information, see [Billing](/maps/billing-and-pricing/billing).\n\nEnable APIs\n-----------\n\nTo use Google Maps Platform, you must enable the APIs or SDKs you plan to use with your project.\n\n### Console\n\n\n[Enable the Directions API](https://console.cloud.google.com/apis/library/directions-backend.googleapis.com?utm_source=Docs_EnableAPIs&utm_content=Docs_directions-backend)\n\n### Cloud SDK\n\n```bash\ngcloud services enable \\\n --project \"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\" \\\n \"directions-backend.googleapis.com\"\n```\n\nRead more about the\n[Google Cloud SDK](https://cloud.google.com/sdk)\n,\n[Cloud SDK installation](https://cloud.google.com/sdk/docs/install)\n, and the following commands:\n\n- [`gcloud services enable`](https://cloud.google.com/sdk/gcloud/reference/services/enable)\n- [`gcloud services disable`](https://cloud.google.com/sdk/gcloud/reference/services/disable)\n\nView enabled APIs\n-----------------\n\n### Console\n\nTo view the APIs or SDKs you have enabled, go to the Google Maps Platform page\nin the Cloud console:\n[Go to Google Maps Platform page](https://console.cloud.google.com/project/_/google/maps-apis/api-list?utm_source=Docs_ProjectViewAPI&utm_content=Docs_directions-backend)\n\n- Additional APIs: These API or SDKs are not enabled.\n- If you see cards for each Map APIs and services, no APIs or SDKs have been enabled.\n\n### gcloud\n\n```bash\ngcloud services list --project \"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\"\n```\n\nRead more about the\n[Google Cloud SDK](https://cloud.google.com/sdk)\n,\n[Cloud SDK installation](https://cloud.google.com/sdk/docs/install)\n, and the following commands:\n\n- [`gcloud services list`](https://cloud.google.com/sdk/gcloud/reference/services/list)\n\nShut down a project\n-------------------\n\nYou can disable billing and release all the Cloud resources that\nare being used in your Cloud project by shutting down\nthat project: \n\n### Console\n\n1. Go to the Projects page:\n\n [Go to the Projects page](https://console.cloud.google.com/iam-admin/projects?utm_source=Docs_ProjectShutdown&utm_content=Docs_directions-backend)\n2. Select the Cloud project that you want to shut down,\n then click **Delete**.\n\nFor more information about managing your Cloud\nprojects, see [Cloud Resource Manager: creating, shutting down, and restoring projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects).\n\n### gcloud\n\n```bash\ngcloud projects delete \"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\"\n```\n\nRead more about the\n[Google Cloud SDK](https://cloud.google.com/sdk)\n,\n[Cloud SDK installation](https://cloud.google.com/sdk/docs/install)\n, and the following commands:\n\n- [`gcloud projects delete`](https://cloud.google.com/sdk/gcloud/reference/projects/delete)\n\nWhat's next\n-----------\n\nAfter setting up your Google Cloud project, you must create and secure\nyour API Key to use the Directions API:\n\n[Use API Keys](/maps/documentation/directions/get-api-key)"]]