Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Cara geocode dalam bahasa tertentu
Fitur ini memungkinkan pemilihan bahasa respons yang disukai dari kode BCP47 yang sesuai. Ini mendeteksi bahasa kueri berdasarkan varian nama dan menggunakan bahasa yang disukai untuk token yang tak tertandingi dan kasus ambigu. Jika tidak ada bahasa yang diminta, API Places memberikan hasil dalam bahasa negara resmi, tetapi memprioritaskan bahasa regional di wilayah yang berbeda. Sebagai strategi fallback, jika ada elemen alamat yang tidak tersedia dalam bahasa yang diminta, Places APIs mengembalikan alamat dalam bahasa default.
Kasus penggunaan potensial
Salah satu kasus penggunaan potensial adalah melokalkan kueri dan/atau hasilnya.
Contoh
- Sample request
-
{ "QueryText":"Patna, Bihar, Bharat", "Language": "HI" }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "Locality", "Title": "पटना, बिहार, भारत", "Address": { "Label": "पटना, बिहार, भारत", "Country": { "Code2": "IN", "Code3": "IND", "Name": "भारत" }, "Region": { "Code": "BR", "Name": "बिहार" }, "SubRegion": { "Name": "पटना" }, "Locality": "पटना", "PostalCode": "800001" }, "Position": [ 85.13752, 25.60134 ], "MapView": [ 85.03222, 25.55157, 85.27107, 25.65917 ], "MatchScores": { "Overall": 1, "Components": { "Address": { "Country": 1, "Region": 1, "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":"Patna, Bihar, Bharat", "Language": "HI" }'
- AWS CLI
-
aws geo-places geocode --key ${YourKey} --query-text "पटना, बिहार, भारत" --language "HI"
- Sample request
-
{ "QueryText":"पटना, बिहार, भारत" }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "Locality", "Title": "Patana, Bihar, Bharat", "Address": { "Label": "Patana, Bihar, Bharat", "Country": { "Code2": "IN", "Code3": "IND", "Name": "Bharat" }, "Region": { "Code": "BR", "Name": "Bihar" }, "SubRegion": { "Name": "Patana" }, "Locality": "Patana", "PostalCode": "800001" }, "Position": [ 85.13752, 25.60134 ], "MapView": [ 85.03222, 25.55157, 85.27107, 25.65917 ], "MatchScores": { "Overall": 1, "Components": { "Address": { "Country": 1, "Region": 1, "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":"पटना, बिहार, भारत" }'
- AWS CLI
-
aws geo-places geocode --key ${YourKey} --query-text "पटना, बिहार, भारत"
- Sample request
-
{ "QueryText":"पटना, बिहार, भारत", "Language": "HI" }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "Locality", "Title": "पटना, बिहार, भारत", "Address": { "Label": "पटना, बिहार, भारत", "Country": { "Code2": "IN", "Code3": "IND", "Name": "भारत" }, "Region": { "Code": "BR", "Name": "बिहार" }, "SubRegion": { "Name": "पटना" }, "Locality": "पटना", "PostalCode": "800001" }, "Position": [ 85.13752, 25.60134 ], "MapView": [ 85.03222, 25.55157, 85.27107, 25.65917 ], "MatchScores": { "Overall": 1, "Components": { "Address": { "Country": 1, "Region": 1, "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":"पटना, बिहार, भारत", "Language": "HI" }'
- AWS CLI
-
aws geo-places geocode --key ${YourKey} --query-text "पटना, बिहार, भारत" --language "HI"