View a markdown version of this page

如何控制地址名稱變體 - Amazon Location Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

如何控制地址名稱變體

AddressNamesMode 指定傳回地址名稱的方式。如果未設定,服務預設會傳回標準化 (官方) 名稱。當設定為 時Matched,回應中的地址名稱是以輸入查詢為基礎,而不是官方名稱。設為 時Administrative,服務會傳回地址元件的官方管理名稱。 Administrative目前僅適用於美國的地址。

潛在的使用案例

  • 地址表單完成:使用 Matched 傳回與使用者輸入相符的名稱,減少自動完成工作流程中的混淆。

  • 地址標準化:使用 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

開發人員秘訣

  • 如果未設定,服務預設會傳回標準化 (官方) 名稱。

  • Administrative 目前僅適用於美國的地址。