

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

# 필터를 사용하여 지오코딩하는 방법
<a name="how-to-geocode-filters"></a>

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

## 잠재적 사용
<a name="geocode-filters-uses"></a>

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

## 예제
<a name="geocode-filters-examples"></a>

### 국가 내 결과 제한
<a name="geocode-filter-country-example"></a>

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

------
#### [ Sample request ]

`IncludeCountries": ["USA"]`가 없으면 Geocode API는 Vancouver, BC, Canada를 반환합니다.

```
{
  "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"]}'
```

------

### 장소 유형 필터로 결과 구체화
<a name="geocode-filter-place-example"></a>

`IncludePlaceTypes`의 값을 지정하여 결과에 해당 장소의 값을 반환합니다.

------
#### [ Sample request ]

`IncludePlaceTypes": ["Street"]`가 없으면 Geocode API는 국가인 Georgia를 반환합니다. **CAN** 및 **USA** 값을 사용하여 `"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"]}'
```

------

## 개발자 팁
<a name="geocode-filters-developer-tips"></a>

주소 지오코딩의 경우 국가 및 장소를 포함한 바이어스 위치를 조합하여 전체 주소 또는 쿼리 구성 요소를 사용합니다. 자세한 내용은 [주소를 지오코딩하는 방법](how-to-geocode-address.md)를 참조하세요.