本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
如何控制地址名称的变体
AddressNamesMode指定如何返回地址名称。如果未设置,则默认情况下,该服务将返回标准化(官方)名称。如果设置为Matched,则响应中的地址名称基于输入查询,而不是官方名称。设置为时Administrative,该服务将返回地址组成部分的官方管理名称。 Administrative目前仅适用于美国的地址。
潜在使用案例
示例
- Sample request
-
{
"QueryText": "100 Universal City Plaza, Hollywood, CA",
"AddressNamesMode": "Matched"
}
- Sample response
-
{
"ResultItems": [
{
"PlaceId": "<Redacted>",
"PlaceType": "PointAddress",
"Title": "100 Universal City Plz, Universal City, CA 91608, United States",
"Address": {
"Label": "100 Universal City Plz, Universal City, CA 91608, United States",
"Country": {
"Code2": "US",
"Code3": "USA",
"Name": "United States"
},
"Region": {
"Code": "CA",
"Name": "California"
},
"Locality": "Universal City",
"PostalCode": "91608",
"Street": "Universal City Plz",
"AddressNumber": "100"
},
"Position": [
-118.36054,
34.13857
]
}
]
}
- 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": "100 Universal City Plaza, Hollywood, CA",
"AddressNamesMode": "Matched"
}'
- AWS CLI
-
aws geo-places geocode --key ${YourKey} --query-text "100 Universal City Plaza, Hollywood, CA" --address-names-mode Matched
- Sample request
-
{
"QueryText": "100 Universal City Plaza, Hollywood, CA",
"AddressNamesMode": "Administrative"
}
- Sample response
-
{
"ResultItems": [
{
"PlaceId": "<Redacted>",
"PlaceType": "PointAddress",
"Title": "100 Universal Terrace Pkwy, Los Angeles, CA 91608, United States",
"Address": {
"Label": "100 Universal Terrace Pkwy, Los Angeles, CA 91608, United States",
"Country": {
"Code2": "US",
"Code3": "USA",
"Name": "United States"
},
"Region": {
"Code": "CA",
"Name": "California"
},
"Locality": "Los Angeles",
"PostalCode": "91608",
"Street": "Universal Terrace Pkwy",
"AddressNumber": "100"
},
"Position": [
-118.36054,
34.13857
]
}
]
}
- 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": "100 Universal City Plaza, Hollywood, CA",
"AddressNamesMode": "Administrative"
}'
- AWS CLI
-
aws geo-places geocode --key ${YourKey} --query-text "100 Universal City Plaza, Hollywood, CA" --address-names-mode Administrative
开发人员提示