翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
フィルターを使用してジオコーディングする方法
Geocode API を使用すると、フィルターを使用して必要な結果を取得できます。
潜在的な使用
フィルターを使用して、ビジネスニーズに基づいて結果を制限します。
例
結果でその国の値を返IncludeCountries
す の値を指定します。
- Sample request
-
がない場合
IncludeCountries": ["USA"]
、Geocode API はカナダのバンクーバー、BC を返します。{ "QueryText": "Vancouver", "Filter" : { "IncludeCountries": ["USA"] } }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "Locality", "Title": "Vancouver, WA, United States", "Address": { "Label": "Vancouver, WA, United States", "Country": { "Code2": "US", "Code3": "USA", "Name": "United States" }, "Region": { "Code": "WA", "Name": "Washington" }, "SubRegion": { "Name": "Clark" }, "Locality": "Vancouver", "PostalCode": "98660" }, "Position": [ -122.67156, 45.63248 ], "MapView": [ -122.77466, 45.57714, -122.46451, 45.69803 ], "MatchScores": { "Overall": 1, "Components": { "Address": { "Locality": 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": "Vancouver", "Filter" : { "IncludeCountries": ["USA"] } }'
- AWS CLI
-
aws geo-places geocode --key ${YourKey} --query-text "Vancouver" --filter '{"IncludeCountries": ["USA"]}'
の値を指定IncludePlaceTypes
して、結果のその場所の値を返します。
- Sample request
-
がない場合
IncludePlaceTypes": ["Street"]
、Geocode API は国であるジョージアを返します。CAN と USA の値"IncludeCountries"
で を追加して結果を比較することで、結果をさらに絞り込むことができます。{ "QueryText": "Georgia", "Filter" : { "IncludePlaceTypes": ["Street"] } }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "Street", "Title": "Georgia, Benito Juárez, CDMX, México", "Address": { "Label": "Georgia, Benito Juárez, CDMX, México", "Country": { "Code2": "MX", "Code3": "MEX", "Name": "México" }, "Region": { "Code": "CDMX", "Name": "Ciudad de México" }, "SubRegion": { "Name": "Ciudad de México" }, "Locality": "Benito Juárez", "Street": "Georgia", "StreetComponents": [ { "BaseName": "Georgia", "Language": "es" } ] }, "Position": [ -99.17754, 19.38887 ], "MapView": [ -99.18133, 19.38755, -99.17374, 19.39016 ], "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": "Georgia", "Filter" : { "IncludePlaceTypes": ["Street"] } }'
- AWS CLI
-
aws geo-places geocode --key ${YourKey} --query-text "Georgia" --filter '{"IncludePlaceTypes": ["Street"]}'
開発者向けのヒント
アドレスのジオコーディングでは、国や場所などのバイアス位置を組み合わせた完全なアドレスまたはクエリコンポーネントを使用してください。詳細についてはアドレスをジオコードする方法を参照してください。
地理空間コンテキストを使用したジオコード
タイムゾーンのジオコード