

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# 位置をリバースジオコーディングする方法
<a name="how-to-reverse-geocode-position"></a>

Reverse Geocode 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"] }
}
```