本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
如何在某个国家/地区附近搜寻
通过 SearchNearby API,您可以搜索特定国家/地区内附近的地点。要使用 API,您需要提供一个 QueryPosition,它可以是:
或者,用户可以提供城市名称或地点,应用程序可以根据该位置的地理坐标对结果进行偏差。
潜在用例
-
探索一个国家内的企业
-
查找一个国家内附近的 B2B 客户
-
探索一个国家的旅游胜地
示例
以下示例演示如何搜索加拿大境内靠近指定坐标的高尔夫球场。
- Sample request
-
此请求搜索加拿大境内指定地点附近的高尔夫球场。
{
"QueryPosition": [
-122.741803,
49.002478
],
"Filter" : {
"IncludeCategories": ["golf_course"],
"IncludeCountries": ["CAN"]
}
}
- Sample response
-
{
"ResultItems": [
{
"PlaceId": "<Redacted>",
"PlaceType": "PointOfInterest",
"Title": "Peace Portal Golf Course",
"Address": {
"Label": "Peace Portal Golf Course, 16900 * Ave, Surrey, BC V*Z *P*, Canada",
"Country": {
"Code2": "CA",
"Code3": "CAN",
"Name": "Canada"
},
"Region": {
"Code": "BC",
"Name": "British Columbia"
},
"SubRegion": {
"Name": "Metro Vancouver"
},
"Locality": "Surrey",
"District": "South Surrey",
"PostalCode": "V*Z *P*",
"Street": "* Ave",
"StreetComponents": [
{
"BaseName": "4",
"Type": "Ave",
"TypePlacement": "AfterBaseName",
"TypeSeparator": " ",
"Language": "en"
}
],
"AddressNumber": "16900"
},
"Position": [
-122.75086,
49.00921
],
"Distance": 998,
"Categories": [
{
"Id": "golf_course",
"Name": "Golf Course",
"LocalizedName": "Golf Course",
"Primary": true
}
],
"Contacts": {
"Phones": [
{
"Value": "+16045384818" }
],
"Websites": [
{
"Value": "http://www.peaceportalgolf.com"
}
]
},
"AccessPoints": [
{
"Position": [
-122.75087,
49.00935
]
}
]
}
]
}
- cURL
-
curl --request POST \
--url 'https://places.geo.eu-central-1.amazonaws.com/v2/search-nearby?key=Your_Key' \
--header 'Content-Type: application/json' \
--data '{
"QueryPosition": [
-122.741803,
49.002478
],
"Filter" : {
"IncludeCategories": ["golf_course"],
"IncludeCountries": ["CAN"]
}
}'
- AWS CLI
-
aws geo-places search-nearby --key ${YourKey} \
--query-position -122.741803 49.002478 \
--filter '{"IncludeCategories": ["golf_course"], "IncludeCountries": ["CAN"]}'