如何使用特定语言进行地理编码 - Amazon Location Service

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

如何使用特定语言进行地理编码

此功能允许从 BCP47兼容代码中选择首选响应语言。它根据名称变体检测查询语言,并使用首选语言处理不匹配的标记和模棱两可的情况。如果没有请求的语言,Plac es API 会以官方国家/地区语言提供搜索结果,但会优先考虑不同区域语言的区域。作为后备策略,如果请求的语言中没有任何地址元素不可用,Plac es 将以默认语言 APIs 返回地址。

潜在用例

一个潜在的用例是本地化查询和/或结果。

示例

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"