如果您的 API 用量足够高,达到了第二层级的价格,则适用此指南。迁移到较新版本的 API 时,您还需要按其他 SKU 付费。为避免在过渡月份增加费用,我们建议您尽可能在月初切换到生产环境中的新 API。这样可以确保您在迁移月份达到最具成本效益的每月价格层级。如需了解价格层级,请参阅价格页面和价格常见问题解答。
启用 Places API
Place 类依赖于 Places API 服务。如需使用新地点类的功能,您必须先在 Google Cloud 项目中启用 Places API(新)。如需了解详情,请参阅使用入门。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-02-25。"],[[["This guide details the transition from the legacy `PlacesService` to the new `Place` class within the Places API."],["The `Place` class offers advantages like enhanced performance, a revised pricing structure, and updated functionalities."],["Key distinctions include the use of Promises instead of callbacks, camel case for data fields, and expanded place types/data fields."],["Developers should enable the \"Places API (New)\" in their Google Cloud project and adapt their code to use the new class and methods."],["Migration guides are available to assist in transitioning specific features like Place Details, Text Search, Nearby Search, and more."]]],["The document details migrating from the legacy Places Service to the new Place class, which offers improved performance and a new pricing structure. Key changes include switching from callbacks to Promises for asynchronous operations, eliminating the need for status checks, and using camel case instead of snake case for data fields. Users must enable the Places API (New) in their Google Cloud project. The new Place class also expands the types of data and place types that are available. Additionally, the best time to switch is near the beginning of the month to take advantage of the best pricing tiers.\n"]]