此产品或功能处于旧版状态。如需详细了解“旧版”状态,请参阅
旧版产品和功能。如需迁移到 Places API(新版),请参阅
迁移指南。
Places API(旧版)概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
简介
借助 Places API,您可以使用文本字符串或按邻近程度搜索和检索各种地点类型的信息。Places API(旧版)是 Places API(新版)的旧版。
下表列出了这两个 API 的对应版本。请参阅本指南,了解这两者之间的主要区别,并迁移到 Places API(新)。
迁移到新 API
如需迁移到新 API,请参阅以下迁移指南:
Places API(新版)新增的主要功能
本部分介绍了添加到 Places API(新版)中的主要功能。
Places API(新)是在 Google Cloud 上的服务基础架构中实现的。此实现带来了更安全、更可信的平台,并提供了增强的安全选项,例如 OAuth。这种标准 API 设计可提高 Places API(新)的开发效率,并使 API 之间保持一定程度的一致性。
Places API(新)可提供更出色的性能,因此值得替换使用现有 Places API 的应用。
简化的价格方案
Places API(新)简化了价格,因此您只需为自己使用的数据付费。简化的价格方案是通过字段掩码实现的。
对于“地点详情(新)”“附近搜索(新)”和“文本搜索(新)”,您可以使用字段掩码来控制要在响应中返回的字段列表。然后,您只需为所请求的数据付费。使用字段遮盖是一种良好的设计做法,可确保您不会请求不必要的数据,这有助于避免产生不必要的处理时间和结算费用。
地点的一致响应数据
使用旧版 API 时,“地点详情(旧版)”“附近搜索(旧版)”和“文本搜索(旧版)”API 会针对同一地点返回不同的响应数据。Places API(新)会标准化响应,以便这些 API 针对同一地点返回相同的数据。
扩展的地点类型
API 响应现在可以包含地点的主要类型。每个地点都可以有一个类型值,该值指定为地点的主要类型,如表 A 中所列。
新 API 还包含多种新类型。您可以在“附近搜索(新)”和“文本搜索(新)”中使用这些新类型以及现有类型进行搜索。所有新类型都包含在表 A 中。
动态地点数据
Places API(新)支持动态响应数据,例如电动汽车充电站的可用性或加油站的最新燃油价格。使用这些响应字段可打造动态用户体验。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[],[],null,["# Places API (Legacy) overview\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nIntroduction\n------------\n\nThe Places API lets you search for and retrieve information for a variety of\nplace types using a text string or by proximity. Places API (Legacy) is the legacy\nversion of\n[Places API (New)](/maps/documentation/places/web-service/op-overview).\n\nThe following table lists the corresponding versions of both APIs. Use this\nguide to understand the key differences between the two and migrate to\nPlaces API (New).\n\n| Places API (Legacy) | Places API (New) | Notes |\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Find Place (Legacy)](/maps/documentation/places/web-service/search-find-place) | [Text Search (New)](/maps/documentation/places/web-service/text-search) | There is no new version of Find Place (Legacy). Text Search (New) has replaced it. |\n| [Nearby Search (Legacy)](/maps/documentation/places/web-service/search-nearby) | [Nearby Search (New)](/maps/documentation/places/web-service/nearby-search) | All requests using the legacy API that include a text query should use [Text Search (New)](/maps/documentation/places/web-service/text-search) because Nearby Search (New) does not support text input. |\n| [Text Search (Legacy)](/maps/documentation/places/web-service/search-text) | [Text Search (New)](/maps/documentation/places/web-service/text-search) | |\n| [Place Details (Legacy)](/maps/documentation/places/web-service/details) | [Place Details (New)](/maps/documentation/places/web-service/place-details) | |\n| [Place Photos (Legacy)](/maps/documentation/places/web-service/photos) | [Place Photos (New)](/maps/documentation/places/web-service/place-photos) | |\n| [Place Autocomplete (Legacy)](/maps/documentation/places/web-service/autocomplete) | [Autocomplete (New)](/maps/documentation/places/web-service/place-autocomplete) | |\n| [Query Autocomplete (Legacy)](/maps/documentation/places/web-service/query) | [Autocomplete (New)](/maps/documentation/places/web-service/place-autocomplete) | Capabilities added to Autocomplete (New). |\n\nMigrate to the new APIs\n-----------------------\n\nTo migrate to the new APIs, see the following migration guides:\n\n- [Migrate to Nearby Search (New)](/maps/documentation/places/web-service/migrate-nearby)\n- [Migrate to Text Search (New)](/maps/documentation/places/web-service/migrate-text)\n- [Migrate to Place Details (New)](/maps/documentation/places/web-service/migrate-details)\n- [Migrate to Place Photos (New)](/maps/documentation/places/web-service/migrate-photo)\n- [Migrate to Autocomplete (New)](/maps/documentation/places/web-service/migrate-autocomplete)\n\nKey features added to Places API (New)\n--------------------------------------\n\nThis section covers key features added to Places API (New).\n\n### Implemented on the Google Cloud standard platform\n\nPlaces API (New) is implemented on the [service\ninfrastructure](https://cloud.google.com/service-infrastructure/docs/overview)\non Google Cloud. This implementation brings with it a more secure and trusted\nplatform with enhanced security options like\n[OAuth](/maps/documentation/places/web-service/oauth-token). This standard API\ndesign brings a level of consistency across the APIs that improve the efficiency\nof development with Places API (New).\n\n### Improved performance\n\nPlaces API (New) provides improved performance, making it worthwhile to\nreplace apps that use the existing Places API.\n\n### Simplified pricing\n\nPricing is simplified with Places API (New) so that you only pay for the\ndata you use. Simplified pricing is implemented using a [field\nmask](/maps/documentation/places/web-service/choose-fields).\n\nWith Place Details (New), Nearby Search (New), and\nText Search (New) you use the field mask to control the list of fields to\nreturn in the response. You are then only billed for the data requested. Using\nfield masking is a good design practice to ensure that you don't request\nunnecessary data, which helps to avoid unnecessary processing time and billing\ncharges.\n\n### Consistent response data for a place\n\nWith the legacy APIs, the Place Details (Legacy), Nearby Search (Legacy), and\nText Search (Legacy) APIs returned different response data for a place.\nPlaces API (New) standardizes the response so these APIs all return the\nsame data for a place.\n\n### Expanded place types\n\nThe API response can now contain a place's *primary type* . Every place can have\na single type value that is specified as the place's primary type, as listed in\n[Table A](/maps/documentation/places/web-service/place-types#table-a).\n\nThe new API also includes several new types. You can use these new types, and\nthe existing types, in a search with Nearby Search (New)\nand Text Search (New). The new types are all included in [Table\nA](/maps/documentation/places/web-service/place-types#table-a).\n\n### Dynamic place data\n\nPlaces API (New) supports dynamic response data, such as the availability\nof an EV charging station or the latest fuel prices for a gas station. Use these\nresponse fields to create dynamic user experiences."]]