필터를 사용하여 주소를 작성하는 방법 - Amazon Location Service

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

필터를 사용하여 주소를 작성하는 방법

자동 완성 API를 사용하면 부분적으로 입력된 주소를 완성하여 최종 사용자의 빠르고 표준화된 주소 입력을 용이하게 할 수 있습니다. AdditionalFeatures 파라미터를 사용하면 특정 요구 사항을 충족하도록 응답에 제공된 정보를 사용자 지정할 수 있습니다.

잠재적 사용 사례

  • 비용 효율성을 위한 데이터 최소화: 후속 쿼리가 예상되는 경우 필수 주소 구성 요소만 요청하여 응답 크기 및 데이터 전송 비용을 줄입니다.

  • 직접 사용에 필요한 세부 정보 포함: 포괄적인 주소 정보를 검색하여 추가 쿼리가 필요하지 않습니다.

예시

이 예제에서는 국가 필터를 적용하여 결과를 구체화함으로써 표준화된 형태의 사용자 입력 주소가 양식 필드를 정확하게 채울 수 있도록 합니다.

Sample request
{ "QueryText": "100 McCullum Rd", "Filter": { "IncludeCountries": [ "GBR" ] } }
Sample response
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointAddress", "Title": "United Kingdom, E3 5JB, London, 100 McCullum Road", "Address": { "Label": "100 McCullum Road, London, E3 5JB, United Kingdom", "Country": { "Code2": "GB", "Code3": "GBR", "Name": "United Kingdom" }, "Region": { "Name": "England" }, "SubRegion": { "Code": "LDN", "Name": "London" }, "Locality": "London", "District": "Bow", "PostalCode": "E3 5JB", "Street": "McCullum Road", "StreetComponents": [ { "BaseName": "McCullum", "Type": "Road", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Language": "en" } ], "AddressNumber": "100" }, "Language": "en", "Highlights": { "Title": [ { "StartIndex": 32, "EndIndex": 35, "Value": "100" }, { "StartIndex": 36, "EndIndex": 49, "Value": "McCullum Road" } ], "Address": { "Label": [ { "StartIndex": 0, "EndIndex": 3, "Value": "100" }, { "StartIndex": 4, "EndIndex": 17, "Value": "McCullum Road" } ], "Street": [ { "StartIndex": 0, "EndIndex": 13, "Value": "McCullum Road" } ], "AddressNumber": [ { "StartIndex": 0, "EndIndex": 3, "Value": "100" } ] } } } ], "QueryRefinements": [] }
cURL
curl --request POST \ --url 'https://places.geo.eu-central-1.amazonaws.com/v2/autocomplete?key=Your_Key' \ --header 'Content-Type: application/json' \ --data '{ "QueryText": "100 McCullum Rd", "Filter": { "IncludeCountries": [ "GBR" ] } }'
AWS CLI
aws geo-places autocomplete --key ${YourKey} --query-text "100 McCullum Rd" \ --filter '{"IncludeCountries": ["GBR"]}'

이 예제에서는 추가 데이터를 반환하여 반환된 주소 세부 정보를 후속 쿼리 없이 사용할 수 있습니다. 이 사용 사례에는 추가 기능 Core 세트로 충분합니다.

Sample request
{ "QueryText": "100 McCullum Rd", "Filter": { "IncludeCountries": [ "GBR" ] }, "AdditionalFeatures": [ "Core" ] }
Sample response
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointAddress", "Title": "United Kingdom, E3 5JB, London, 100 McCullum Road", "Address": { "Label": "100 McCullum Road, London, E3 5JB, United Kingdom", "Country": { "Code2": "GB", "Code3": "GBR", "Name": "United Kingdom" }, "Region": { "Name": "England" }, "SubRegion": { "Code": "LDN", "Name": "London" }, "Locality": "London", "District": "Bow", "PostalCode": "E3 5JB", "Street": "McCullum Road", "StreetComponents": [ { "BaseName": "McCullum", "Type": "Road", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Language": "en" } ], "AddressNumber": "100" }, "Language": "en", "Highlights": { "Title": [ { "StartIndex": 32, "EndIndex": 35, "Value": "100" }, { "StartIndex": 36, "EndIndex": 49, "Value": "McCullum Road" } ], "Address": { "Label": [ { "StartIndex": 0, "EndIndex": 3, "Value": "100" }, { "StartIndex": 4, "EndIndex": 17, "Value": "McCullum Road" } ], "Street": [ { "StartIndex": 0, "EndIndex": 13, "Value": "McCullum Road" } ], "AddressNumber": [ { "StartIndex": 0, "EndIndex": 3, "Value": "100" } ] } } } ], "QueryRefinements": [] }
cURL
curl --request POST \ --url 'https://places.geo.eu-central-1.amazonaws.com/v2/autocomplete?key=Your_Key' \ --header 'Content-Type: application/json' \ --data '{ "QueryText": "100 McCullum Rd", "Filter": { "IncludeCountries": [ "GBR" ] }, "AdditionalFeatures": [ "Core" ] }'
AWS CLI
aws geo-places autocomplete --key ${YourKey} --query-text "100 McCullum Rd" \ --additional-features "Core" \ --filter '{"IncludeCountries": ["GBR"]}'