

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

# 如何反轉位置的地理碼
<a name="how-to-reverse-geocode-position"></a>

反向地理碼 API 可讓您根據位置查詢將地理碼轉換為地理區域。API 回應包含位置詳細資訊，提供與特定座標相關聯的位置資訊。

## 潛在的使用案例
<a name="potential-use"></a>
+ **存放位置資訊：**將位置詳細資訊新增至包含地理座標的資料存放區。
+ **地圖視覺化：**使用位置資訊在地圖上顯示資料。
+ **使用者位置偵測：**根據使用者的裝置位置來識別使用者的位置。

## 反向地理編碼位置
<a name="reverse-geocode-position"></a>

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

```
{
  "QueryPosition": [
    -123.11694,
    49.28126
  ]
}
```

------
#### [ Sample response ]

```
{
    "ResultItems": [
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "PointAddress",
            "Title": "510 W Georgia St, Vancouver, BC V6B 0M3, Canada",
            "Address": {
                "Label": "510 W Georgia St, Vancouver, BC V6B 0M3, Canada",
                "Country": { "Code2": "CA", "Code3": "CAN", "Name": "Canada" },
                "Region": { "Code": "BC", "Name": "British Columbia" },
                "SubRegion": { "Name": "Metro Vancouver" },
                "Locality": "Vancouver",
                "District": "Downtown Vancouver",
                "PostalCode": "V6B 0M3",
                "Street": "W Georgia St",
                "StreetComponents": [
                    { "BaseName": "Georgia", "Type": "St", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Prefix": "W", "Language": "en" }
                ],
                "AddressNumber": "510"
            },
            "Position": [-123.11694, 49.28126],
            "Distance": 0,
            "MapView": [-123.11813, 49.27786, -123.11076, 49.28246],
            "AccessPoints": [
                { "Position": [-123.11656, 49.28151] }
            ]
        }
    ]
}
```

------
#### [ 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": [
            -123.11694,
            49.28126
        ]
}'
```

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

```
aws geo-places reverse-geocode --key ${YourKey} --query-position "-123.11694,49.28126"
```

------

## 反向地理編碼具有多個結果的位置
<a name="reverse-geocode-position-multiple-results"></a>

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

```
{
  "QueryPosition": [
    -123.11694,
    49.28126
  ],
  "MaxResults": "3"
}
```

------
#### [ Sample response ]

```
{
    "ResultItems": [
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "PointAddress",
            "Title": "510 W Georgia St, Vancouver, BC V6B 0M3, Canada",
            "Address": { /* Address details */ },
            "Position": [-123.11694, 49.28126],
            "Distance": 0,
            "MapView": [/* Map view details */],
            "AccessPoints": [/* Access point details */]
        },
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "PointOfInterest",
            "Title": "ChargePoint",
            "Address": { /* Address details */ },
            "Position": [-123.11663, 49.28116],
            "Distance": 25,
            "Categories": [/* Category details */],
            "AccessPoints": [/* Access point details */]
        },
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "PointOfInterest",
            "Title": "Zipcar",
            "Address": { /* Address details */ },
            "Position": [-123.11715, 49.28094],
            "Distance": 29,
            "Categories": [/* Category details */],
            "AccessPoints": [/* Access point details */]
        }
    ]
}
```

------
#### [ 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": [
            -123.11694,
            49.28126
        ],
        "MaxResults": "3"
}'
```

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

```
aws geo-places reverse-geocode --key ${YourKey} --query-position "-123.11694,49.28126" --max-results "3"
```

------

## 開發人員秘訣
<a name="developer-tips"></a>

針對目標結果，請在篩選條件`IncludePlaceTypes`中使用 。

```
{
  "QueryPosition": [
    -123.11694,
    49.28126
  ],
  "Filter": { "IncludePlaceTypes": ["PointAddress"] }
}
```