是的,它确实。将 Amazon Location's Places API 用于您的用例,特别是 SearchPlaceIndexForText 操作。有了它,您可以搜索地名、地址和公司名称,并得到两个结果:地理坐标和地址组成部分。地址组件是您所需要的,它为您提供国家、州、城市、邮政编码等信息。如果需要,您还可以存储结果;在创建地点索引资源时检查Data storage option。
下面是一个示例请求(使用 AWS CLI)和使用邮政编码作为输入的响应:
aws location search-place-index-for-text
--index-name HerePlace
--text "98121"
--filter-countries "USA"
--max-results 1
{
"Results": [
{
"Place": {
"Country": "USA",
"Geometry": {
"Point": [
-122.34468,
47.61578
]
},
"Interpolated": false,
"Label": "98121, Seattle, WA, United States",
"Municipality": "Seattle",
"PostalCode": "98121",
"Region": "Washington",
"SubRegion": "King",
"TimeZone": {
"Name": "America/Los_Angeles",
"Offset": -28800
}
}
}
],
"Summary": {
"DataSource": "Here",
"FilterCountries": [
"USA"
],
"MaxResults": 1,
"ResultBBox": [
-122.34468,
47.61578,
-122.34468,
47.61578
],
"Text": "98121"
}
}
希望这可以帮助。