最低限度 google 放置 api 字段以进行 react-geosuggest 工作?

Bare minimum google places api fields to have react-geosuggest work?

Google 已在去年更改了 maps/places api 定价。我希望在项目中包含自动完成输入。我主要是在寻找家庭地址(与房地产相关),所以我认为我不需要大部分额外的服务字段(地点详细信息、大气等)

我正在使用 react-geosuggest,它有一个道具 placeDetailFields 允许以下操作:

Type: Array Default: null

By default Google returns all fields when getting place details which can impact billing. You can optionally pass an array of fields to include in place results to limit what is returned and potentially reduce billing impact. geometry will always be added as we depend on the location for the suggest selection.

因为 address_components 调用之间可能不同,为了得到一个共同的邮政地址,例如

应该调用的最低限度字段是多少
    lat: String
    lng: String
    placeId: String
    fullAddress: String
    postal: String
    country: String
    state: String
    city: String
    street: String

必须调用地点详细信息服务才能从自动完成建议中获取有关所选地点的信息。

Basic Data fields have no additional costs 并包含以下字段:

address_component, adr_address, formatted_address, geometry, icon, name, permanently_closed, photo, place_id, plus_code, type, url, utc_offset, vicinity

要获得 lat/lng 使用 geometry.location.

要获取地点 ID,请使用 place_id

要获取完整地址,请使用 formatted_address

要获取邮政编码,请使用 address_components.types["postal_code"]

要获取国家/地区,请使用 address_components.types["country"]

要获取状态,请使用 address_components.types["administrative_area_level_1"]

要获取城市,请使用 address_components.types["locality"]

要获得街道使用 address_components.types["route"]

Google 的自动完成 + 地点详细信息 + 字段示例可以在 these links.

中找到

注意:尽管这些都是基本数据字段,但地点详情和地点自动完成都是收费服务。为完全避免收费,请查看设置 daily quota limits.

希望对您有所帮助!