필터를 사용하여 지오코딩하는 방법 - Amazon Location Service

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

필터를 사용하여 지오코딩하는 방법

지오코드 API를 사용하면 필터를 사용하여 원하는 결과를 얻을 수 있습니다.

잠재적 사용

필터를 사용하여 비즈니스 요구 사항에 따라 결과를 제한합니다.

예시

의 값을 지정IncludeCountries하여 결과에 해당 국가의 값을 반환합니다.

Sample request

이 없으면 IncludeCountries": ["USA"]지오코드 API는 캐나다 BC의 밴쿠버를 반환합니다.

{ "QueryText": "Vancouver", "Filter" : { "IncludeCountries": ["USA"] } }
Sample response
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "Locality", "Title": "Vancouver, WA, United States", "Address": { "Label": "Vancouver, WA, United States", "Country": { "Code2": "US", "Code3": "USA", "Name": "United States" }, "Region": { "Code": "WA", "Name": "Washington" }, "SubRegion": { "Name": "Clark" }, "Locality": "Vancouver", "PostalCode": "98660" }, "Position": [ -122.67156, 45.63248 ], "MapView": [ -122.77466, 45.57714, -122.46451, 45.69803 ], "MatchScores": { "Overall": 1, "Components": { "Address": { "Locality": 1 } } } } ] }
cURL
curl --request POST \ --url 'https://places.geo.eu-central-1.amazonaws.com/v2/geocode?key=Your_Key' \ --header 'Content-Type: application/json' \ --data '{ "QueryText": "Vancouver", "Filter" : { "IncludeCountries": ["USA"] } }'
AWS CLI
aws geo-places geocode --key ${YourKey} --query-text "Vancouver" --filter '{"IncludeCountries": ["USA"]}'

의 값을 지정IncludePlaceTypes하여 결과에 해당 위치에 대한 값을 반환합니다.

Sample request

이 없으면 IncludePlaceTypes": ["Street"]지오코드 API가 국가인 Georgia를 반환합니다. CAN미국 값을 "IncludeCountries" 추가하여 결과를 더욱 구체화하고 결과를 비교할 수 있습니다.

{ "QueryText": "Georgia", "Filter" : { "IncludePlaceTypes": ["Street"] } }
Sample response
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "Street", "Title": "Georgia, Benito Juárez, CDMX, México", "Address": { "Label": "Georgia, Benito Juárez, CDMX, México", "Country": { "Code2": "MX", "Code3": "MEX", "Name": "México" }, "Region": { "Code": "CDMX", "Name": "Ciudad de México" }, "SubRegion": { "Name": "Ciudad de México" }, "Locality": "Benito Juárez", "Street": "Georgia", "StreetComponents": [ { "BaseName": "Georgia", "Language": "es" } ] }, "Position": [ -99.17754, 19.38887 ], "MapView": [ -99.18133, 19.38755, -99.17374, 19.39016 ], "MatchScores": { "Overall": 1, "Components": { "Address": { "Intersection": [ 1 ] } } } } ] }
cURL
curl --request POST \ --url 'https://places.geo.eu-central-1.amazonaws.com/v2/geocode?key=Your_Key' \ --header 'Content-Type: application/json' \ --data '{ "QueryText": "Georgia", "Filter" : { "IncludePlaceTypes": ["Street"] } }'
AWS CLI
aws geo-places geocode --key ${YourKey} --query-text "Georgia" --filter '{"IncludePlaceTypes": ["Street"]}'

개발자 팁

주소 지오코딩의 경우 국가 및 위치를 포함하여 바이어스 위치를 조합하여 전체 주소 또는 쿼리 구성 요소를 사용하세요. 자세한 내용은 주소를 지오코딩하는 방법를 참조하세요.