국가 내에서 장소를 검색하는 방법 - Amazon Location Service

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

국가 내에서 장소를 검색하는 방법

SearchText API를 사용하면 검색 결과를 하나 이상의 국가로 제한할 수 있습니다. 이 기능은 경계 영역 또는 서로 인접한 작은 국가에서 검색하는 데 유용합니다.

SearchText API를 사용하는 한 가지 방법은 최종 사용자가 자유 텍스트 검색과 애플리케이션 세트의 바이어스 위치를 수행하도록 하는 것입니다. 이러한 바이어스 위치는 디바이스 위치, IP 위치 또는 맵의 뷰 포트 중심일 수 있습니다. 또한 최종 사용자는 도시 이름이나 장소를 제공할 수 있으며 애플리케이션은 지역 좌표에 따라 결과를 편향시킬 수 있습니다.

잠재적 사용 사례

  • 가까운 국경이 있는 지역의 경우 검색 결과를 국가 내로 제한합니다.

  • 여러 국가 내에서 결과를 필터링합니다.

예제

이 예제에서 바이어스 위치는 미국 및 캐나다 경계 근처에 있습니다. IncludeCountries": ["CAN"]을 지정하지 않으면 API는 캐나다와 미국의 결과를 모두 반환합니다.

Sample request
{ "QueryText": "Starbucks", "BiasPosition": [ -122.741803, 49.002478 ] }
Sample response
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointOfInterest", "Title": "STARBUCKS", "Address": { "Label": "STARBUCKS, 16010 24 Ave, Surrey, BC V3Z 0R5, Canada", "Country": { "Code2": "CA", "Code3": "CAN", "Name": "Canada" }, "Region": { "Code": "BC", "Name": "British Columbia" }, "SubRegion": { "Name": "Metro Vancouver" }, "Locality": "Surrey", "District": "South Surrey", "PostalCode": "V3Z 0R5", "Street": "24 Ave", "StreetComponents": [ { "BaseName": "24", "Type": "Ave", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Language": "en" } ], "AddressNumber": "16010" }, "Position": [ -122.77867, 49.04482 ], "Distance": 5422, "Categories": [ { "Id": "coffee_shop", "Name": "Coffee Shop", "LocalizedName": "Coffee Shop", "Primary": true } ] }, { "PlaceId": "<Redacted>", "PlaceType": "PointOfInterest", "Title": "STARBUCKS", "Address": { "Label": "STARBUCKS, 1730 152 St, Surrey, BC V4A 4N4, Canada", "Country": { "Code2": "CA", "Code3": "CAN", "Name": "Canada" }, "Region": { "Code": "BC", "Name": "British Columbia" }, "SubRegion": { "Name": "Metro Vancouver" }, "Locality": "Surrey", "District": "South Surrey", "PostalCode": "V4A 4N4", "Street": "152 St", "StreetComponents": [ { "BaseName": "152", "Type": "St", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Language": "en" } ], "AddressNumber": "1730" }, "Position": [ -122.80096, 49.03341 ], "Distance": 5517, "Categories": [ { "Id": "coffee_shop", "Name": "Coffee Shop", "LocalizedName": "Coffee Shop", "Primary": true } ], "BusinessChains": [ { "Name": "Starbucks", "Id": "Starbucks" } ] }, ... ... ] }
cURL
curl --request POST \ --url 'https://places.geo.eu-central-1.amazonaws.com/v2/search-text?key=Your_Key' \ --header 'Content-Type: application/json' \ --data '{ "QueryText": "Starbucks", "BiasPosition": [ -122.741803, 49.002478 ] }'
AWS CLI
aws geo-places search-text --key ${YourKey} --query-text "Starbucks" --bias-position -122.741803 49.002478