Select Google 放置详细信息字段

Select Google place detail fields

我正在使用 Google 地点 API 获取有关特定地点的详细信息。

我希望能够限制 return 由地点详情编辑的字段数。例如,获取 Google Places API 到 return 只有名称、phone 地点的编号和位置。

我从文档中阅读了这篇文章,但它没有讨论它: https://developers.google.com/places/web-service/details?hl=es-419

有什么想法吗?

定义哪些字段应在 Places API 网络服务的响应中可用的功能将于今天、2018 年 6 月 11 日或接下来的几天内生效。

我看到您正在检查西班牙语版本的文档。 Google 地图文档的本地化翻译通常已过时。我建议总是只检查 English version。但是,正如我所看到的 Google 还没有更新英文版本。我希望在几天内得到更新的文档。

同时,您可以在用户指南中找到有关向 Google Maps Platform 过渡的字段的说明。

https://cloud.google.com/maps-platform/user-guide/product-changes/#frequently-asked-questions

根据用户指南,

Places Details requests will be updated to return only the fields that you specify. Currently when you make a Places Details request, the API returns all of the available data associated with the specified place. With this change, the response is limited to only those fields specified using the fields parameter.

The fields correspond to Places Details results, and are divided into three billing categories: Basic, Contact, and Atmosphere. The cost for each request varies depending on which fields are selected;

The Basic category does not result in any additional charge and includes the following fields:

place_id, name, type, address_components, formatted_address, url, utc_offset, permanently_closed, geometry.location, geometry.viewport, photo.photo_reference, icon, types, adr_address, scope, vicinity

The Contact category results in an additional charge and includes the following fields:

opening_hours.weekday_text, opening_hours.open_now, opening_hours.period, website, formatted_phone_number, international_phone_number

The Atmosphere category results in an additional charge and includes the following fields:

price_level, rating, reviews

根据此文档,您应该创建以下请求

https://maps.googleapis.com/maps/api/place/details/json?placeid=YOUR_PLACE_ID&fields=name,formatted_phone_number,geometry.location&key=YOUR_API_KEY

我刚刚尝试过这个请求,但看起来 Google 还没有打开字段过滤器。我得到了响应中的所有字段。我相信几天后就能看到这个功能的实际应用。

希望对您有所帮助!