

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

# 地理空間コンテキストを使用してジオコーディングする方法
<a name="how-to-geocode-geospatial"></a>

Geocode API を使用すると、地理空間コンテキスト (バイアス位置など) を使用して必要な結果を取得できます。

**注記**  
「バイアス位置」とは、ユーザーが指定した場所または定義されたエリアに基づいて検索結果を優先するメカニズムを指します。基本的に、検索結果の焦点を指定されたバイアスポイントに地理的に近い場所に向けることになりますが、他の結果を必ずしも除外するわけではありません。

## 想定される用途
<a name="geospatial-uses"></a>

地理空間コンテキストを使用して、ビジネスニーズに基づいて正しい結果を取得します。

## 例
<a name="geospatial-examples"></a>

### 位置へのバイアス結果
<a name="bias-position-example"></a>

位置にバイアスを掛けることにより、検索結果のランキングを変更できます。次の例で、`BiasPosition` の値をありとなしで比較して、結果を比較してみてください。

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

```
{
    "QueryText": "George Street",
    "BiasPosition": [
                151.2059,
                -33.8691
            ]
}
```

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

```
{
    "ResultItems": [
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "Street",
            "Title": "George St, Sydney NSW, Australia",
            "Address": {
                "Label": "George St, Sydney NSW, Australia",
                "Country": {
                    "Code2": "AU",
                    "Code3": "AUS",
                    "Name": "Australia"
                },
                "Region": {
                    "Code": "NSW",
                    "Name": "New South Wales"
                },
                "Locality": "Sydney",
                "Street": "George St",
                "StreetComponents": [
                    {
                        "BaseName": "George",
                        "Type": "St",
                        "TypePlacement": "AfterBaseName",
                        "TypeSeparator": " ",
                        "Language": "en"
                    }
                ]
            },
            "Position": [
                151.20691,
                -33.86974
            ],
            "Distance": 117,
            "MapView": [
                151.20225,
                -33.88406,
                151.20912,
                -33.85635
            ],
            "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": "George Street",
    "BiasPosition": [
                151.2059,
                -33.8691
            ]
}'
```

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

```
aws geo-places geocode --key ${YourKey} --query-text "George Street" --bias-position 151.2059 -33.8691
```

------

## デベロッパー向けのヒント
<a name="geospatial-developer-tips"></a>

住所のジオコーディングでは、国や場所などのバイアス位置を組み合わせた完全な住所またはクエリコンポーネントを使用するようにしてください。詳細については[住所をジオコーディングする方法](how-to-geocode-address.md)を参照してください。