gpt4 book ai didi

ios - 限制地点自动完成的结果 - GOOGLE API AUTO COMPLETE

转载 作者:行者123 更新时间:2023-11-29 01:17:00 25 4
gpt4 key购买 nike

我正在使用 Google API 获取自动完成建议。我正在从 Google 服务获得所有结果。现在我只需要 CITY STATE 和 COUNTRY 的建议,而不是一个地方的完整地址。我已经引用了我了解的开发人员指南,我们可以使用 Places Type 限制建议。请参阅此链接 https://developers.google.com/places/supported_types .我不知道如何根据我的建议设置此类型。请帮忙。

最佳答案

从 GooglePlace API 获取 json 响应后,根据城市、州、国家/地区进行相应的格式化

根据谷歌文档:----

When the Places service returns results from a details request, it places them within a single result. Each result may contain the following fields:

address_components[] is an array of separate address components used to compose a given address. For example, the address "111 8th Avenue, New York, NY" contains separate address components for "111" (the street number, "8th Avenue" (the route), "New York" (the city) and "NY" (the US state). Each address_component typically contains:

types[] is an array indicating the type of the address component.

long_name is the full text description or name of the address component.

short_name is an abbreviated textual name for the address component, if available. For example, an address component for the state of Alaska may have a long_name of "Alaska" and a short_name of "AK" using the 2-letter postal abbreviation.

formatted_address is a string containing the human-readable address of this place. Often this address is equivalent to the "postal address," which sometimes differs from country to country. This address is generally composed of one or more address_component fields.

关于ios - 限制地点自动完成的结果 - GOOGLE API AUTO COMPLETE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35053843/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com