

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 如何反轉地理編碼以取得正確的結果
<a name="reverse-geocode-filter-right-result"></a>

本指南提供精簡反向地理編碼結果的方法，確保傳回的資料與特定業務需求密切一致。使用篩選條件，使用者可以縮小結果範圍，以更精確地比對地址點、街道或地區等類型。

## 潛在使用案例
<a name="reverse-geocode-potential-use"></a>
+ **限制特定需求的結果：**根據業務需求，使用篩選條件僅擷取最相關的資訊，例如確切地址或更廣泛的地區性資料。

## 範例
<a name="reverse-geocode-examples"></a>

### 篩選點地址
<a name="reverse-geocode-point-address"></a>

透過篩選 `PointAddress`，您可以擷取特定街道地址，提高位置準確性。

------
#### [ Sample Request ]

```
{
    "QueryPosition": [
        -97.721, 30.404
    ],
    "Filter": {
        "IncludePlaceTypes": [
            "PointAddress"
        ]
    }
}
```

------
#### [ Sample Response ]

```
{
    "ResultItems": [
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "PointAddress",
            "Title": "11721 Domain Blvd, Austin, TX 78758-0051, United States",
            "Address": {
                "Label": "11721 Domain Blvd, Austin, TX 78758-0051, United States",
                "Country": {
                    "Code2": "US",
                    "Code3": "USA",
                    "Name": "United States"
                },
                "Region": {
                    "Code": "TX",
                    "Name": "Texas"
                },
                "SubRegion": {
                    "Name": "Travis"
                },
                "Locality": "Austin",
                "District": "North Burnet",
                "PostalCode": "78758-0051",
                "Street": "Domain Blvd",
                "StreetComponents": [
                    {
                        "BaseName": "Domain",
                        "Type": "Blvd",
                        "TypePlacement": "AfterBaseName",
                        "TypeSeparator": " ",
                        "Language": "en"
                    }
                ],
                "AddressNumber": "11721"
            },
            "Position": [
                -97.72087,
                30.404
            ],
            "Distance": 5,
            "MapView": [
                -97.72219,
                30.40273,
                -97.72057,
                30.40649
            ]
        }
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://places.geo.eu-central-1.amazonaws.com/v2/reverse-geocode?key=Your_Key' \
  --header 'Content-Type: application/json' \
  --data '{
  "{
    "QueryPosition": [
        -97.721,  30.404
    ],
    "Filter": {
        "IncludePlaceTypes": [
            "PointAddress"
        ]
    }'
```

------
#### [ AWS CLI ]

```
aws geo-places reverse-geocode --key ${YourKey} --query-position -97.721 30.404 --filter '{"IncludePlaceTypes": ["PointAddress"]}'
```

------

### 街道的篩選條件
<a name="reverse-geocode-street"></a>

透過篩選 `Street`，API 會傳回沒有特定地址號碼的街道層級資料。

------
#### [ Sample Request ]

```
{
    "QueryPosition": [
        -97.721, 30.404
    ],
    "Filter": {
        "IncludePlaceTypes": [
            "Street"
        ]
    }
}
```

------
#### [ Sample Response ]

```
{
    "ResultItems": [
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "Street",
            "Title": "Domain Blvd, Austin, TX 78758, United States",
            "Address": {
                "Label": "Domain Blvd, Austin, TX 78758, United States",
                "Country": {
                    "Code2": "US",
                    "Code3": "USA",
                    "Name": "United States"
                },
                "Region": {
                    "Code": "TX",
                    "Name": "Texas"
                },
                "SubRegion": {
                    "Name": "Travis"
                },
                "Locality": "Austin",
                "District": "North Burnet",
                "PostalCode": "78758",
                "Street": "Domain Blvd",
                "StreetComponents": [
                    {
                        "BaseName": "Domain",
                        "Type": "Blvd",
                        "TypePlacement": "AfterBaseName",
                        "TypeSeparator": " ",
                        "Language": "en"
                    }
                ]
            },
            "Position": [
                -97.72103,
                30.40399
            ],
            "Distance": 3,
            "MapView": [
                -97.72219,
                30.40273,
                -97.72057,
                30.40649
            ]
        }
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://places.geo.eu-central-1.amazonaws.com/v2/reverse-geocode?key=Your_Key' \
  --header 'Content-Type: application/json' \
  --data '{
  "{
    "QueryPosition": [
        -97.721,  30.404
    ],
    "Filter": {
        "IncludePlaceTypes": [
            "Street"
        ]
    }'
```

------
#### [ AWS CLI ]

```
aws geo-places reverse-geocode --key ${YourKey} --query-position -97.721 30.404 --filter '{"IncludePlaceTypes": ["Street"]}'
```

------

### 區域篩選
<a name="reverse-geocode-locality"></a>

透過篩選 `Locality`，您可以擷取更廣泛的位置資料，包括城市名稱。

------
#### [ Sample Request ]

```
{
    "QueryPosition": [
        -97.721, 30.404
    ],
    "Filter": {
        "IncludePlaceTypes": [
            "Locality"
        ]
    }
}
```

------
#### [ Sample Response ]

```
{
    "ResultItems": [
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "Locality",
            "Title": "Austin, TX, United States",
            "Address": {
                "Label": "Austin, TX, United States",
                "Country": {
                    "Code2": "US",
                    "Code3": "USA",
                    "Name": "United States"
                },
                "Region": {
                    "Code": "TX",
                    "Name": "Texas"
                },
                "SubRegion": {
                    "Name": "Travis"
                },
                "Locality": "Austin",
                "PostalCode": "78701"
            },
            "Position": [
                -97.74299,
                30.26759
            ],
            "Distance": 0,
            "MapView": [
                -98.06484,
                30.06592,
                -97.55914,
                30.51965
            ]
        }
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://places.geo.eu-central-1.amazonaws.com/v2/reverse-geocode?key=Your_Key' \
  --header 'Content-Type: application/json' \
  --data '{
  "{
    "QueryPosition": [
        -97.721,  30.404
    ],
    "Filter": {
        "IncludePlaceTypes": [
            "Locality"
        ]
    }'
```

------
#### [ AWS CLI ]

```
aws geo-places reverse-geocode --key ${YourKey} --query-position -97.721 30.404 --filter '{"IncludePlaceTypes": ["Locality"]}'
```

------