

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

# 国内の場所を検索する方法
<a name="how-to-search-place-in-country"></a>

`SearchText` API を使用すると、1 つ以上の国内での検索結果に制限できます。この機能は、境界地域または隣接する小さな国で検索する場合に便利です。

SearchText API を使用する 1 つの方法は、エンドユーザーがフリーテキスト検索とアプリケーションセットのバイアス位置を実行できるようにすることです。これらのバイアス位置は、デバイス位置、IP 位置、またはマップのビューポートの中心です。さらに、エンドユーザーが都市名や場所を指定すると、アプリケーションは地理座標に基づいて結果にバイアスを掛けることができます。

## 想定されるユースケース
<a name="potential-use-place-in-country"></a>
+ 検索結果を、国境が近い地域の国内に限定します。
+ 複数の国内で結果をフィルタリングします。

## 例
<a name="search-place-in-country-examples"></a>

### 国内で検索する
<a name="search-within-country"></a>

この例では、バイアス位置は米国とカナダの境界近くにあります。`IncludeCountries": ["CAN"]` を指定しない場合、API はカナダと米国の両方の結果を返します。

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

```
{
    "QueryText": "Starbucks",
    "BiasPosition": [
                -122.741803, 
                 49.002478
            ]
}
```

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

```
{
    "ResultItems": [
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "PointOfInterest",
            "Title": "STARBUCKS",
            "Address": {
                "Label": "STARBUCKS, 16010 24 Ave, Surrey, BC V3Z 0R5, Canada",
                "Country": {
                    "Code2": "CA",
                    "Code3": "CAN",
                    "Name": "Canada"
                },
                "Region": {
                    "Code": "BC",
                    "Name": "British Columbia"
                },
                "SubRegion": {
                    "Name": "Metro Vancouver"
                },
                "Locality": "Surrey",
                "District": "South Surrey",
                "PostalCode": "V3Z 0R5",
                "Street": "24 Ave",
                "StreetComponents": [
                    {
                        "BaseName": "24",
                        "Type": "Ave",
                        "TypePlacement": "AfterBaseName",
                        "TypeSeparator": " ",
                        "Language": "en"
                    }
                ],
                "AddressNumber": "16010"
            },
            "Position": [
                -122.77867,
                49.04482
            ],
            "Distance": 5422,
            "Categories": [
                {
                    "Id": "coffee_shop",
                    "Name": "Coffee Shop",
                    "LocalizedName": "Coffee Shop",
                    "Primary": true
                }
            ]
        },
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "PointOfInterest",
            "Title": "STARBUCKS",
            "Address": {
                "Label": "STARBUCKS, 1730 152 St, Surrey, BC V4A 4N4, Canada",
                "Country": {
                    "Code2": "CA",
                    "Code3": "CAN",
                    "Name": "Canada"
                },
                "Region": {
                    "Code": "BC",
                    "Name": "British Columbia"
                },
                "SubRegion": {
                    "Name": "Metro Vancouver"
                },
                "Locality": "Surrey",
                "District": "South Surrey",
                "PostalCode": "V4A 4N4",
                "Street": "152 St",
                "StreetComponents": [
                    {
                        "BaseName": "152",
                        "Type": "St",
                        "TypePlacement": "AfterBaseName",
                        "TypeSeparator": " ",
                        "Language": "en"
                    }
                ],
                "AddressNumber": "1730"
            },
            "Position": [
                -122.80096,
                49.03341
            ],
            "Distance": 5517,
            "Categories": [
                {
                    "Id": "coffee_shop",
                    "Name": "Coffee Shop",
                    "LocalizedName": "Coffee Shop",
                    "Primary": true
                }
            ],
            "BusinessChains": [
                {
                    "Name": "Starbucks",
                    "Id": "Starbucks"
                }
            ]
        },
        ...
        ...
    ]
}
```

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

```
curl --request POST \
  --url 'https://places.geo.eu-central-1.amazonaws.com/v2/search-text?key=Your_Key' \
  --header 'Content-Type: application/json' \
  --data '{
    "QueryText": "Starbucks",
    "BiasPosition": [
                -122.741803, 
                49.002478
            ]
}'
```

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

```
aws geo-places search-text --key ${YourKey} --query-text "Starbucks" --bias-position -122.741803 49.002478
```

------