国内の場所を検索する方法 - Amazon Location Service

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

国内の場所を検索する方法

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

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

潜在的なユースケース

  • 検索結果は、国境が近い地域の国内に限定します。

  • 複数の国を持つ に結果をフィルタリングします。

この例では、バイアス位置は米国とカナダの境界近くにあります。を指定しない場合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