기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
한 국가 근처에서 검색하는 방법
SearchNearby API를 사용하면 특정 국가 내의 가까운 위치를 검색할 수 있습니다. API를 사용하려면 다음과 같은 QueryPosition을 제공해야 합니다.
-
디바이스 위치
-
IP 기반 위치
-
맵의 뷰포트 중앙
또는 사용자가 도시 이름이나 위치를 제공할 수 있으며 애플리케이션은 해당 위치의 지역 좌표에 따라 결과를 편향시킬 수 있습니다.
잠재적 사용 사례
-
한 국가 내 비즈니스 탐색
-
한 국가 내에서 가까운 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"]}'