如何根據業務鏈搜尋附近的 - Amazon Location Service

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

如何根據業務鏈搜尋附近的

SearchNearby API 可讓您查詢附近的商業鏈。您可以在搜尋中包含或排除特定業務鏈。此功能可讓最終使用者探索鄰里、探索興趣點等。

若要使用 SearchNearby API,您需要提供 QueryPosition,其可以是:

  • 裝置位置

  • IP 型位置

  • 地圖的檢視區中心

或者,使用者可以提供城市名稱或位置,而應用程式可以根據該位置的地理座標來偏差結果。

如需受支援業務鏈的詳細資訊,請參閱 Business Chains 篩選條件

潛在的使用案例

  • 探索附近的企業

  • 透過尋找附近的 B2B 客戶來擴展您的業務

範例

下列範例示範如何搜尋附近的 Starbucks 位置。

Sample request

此請求會搜尋指定座標附近的 Starbucks 位置。

{ "QueryPosition": [ 12.49563, 41.90325 ], "Filter" : { "IncludeBusinessChains": ["Starbucks"] } }
Sample response
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointOfInterest", "Title": "Starbucks", "Address": { "Label": "Starbucks, Via Giovanni Giolitti, 2, 00185 Roma RM, Italia", "Country": { "Code2": "IT", "Code3": "ITA", "Name": "Italia" }, "Region": { "Name": "Lazio" }, "SubRegion": { "Code": "RM", "Name": "Roma" }, "Locality": "Roma", "District": "Esquilino", "PostalCode": "00185", "Street": "Via Giovanni Giolitti", "StreetComponents": [ { "BaseName": "Giovanni Giolitti", "Type": "Via", "TypePlacement": "BeforeBaseName", "TypeSeparator": " ", "Language": "it" } ], "AddressNumber": "2" }, "Position": [ 12.50102, 41.90093 ], "Distance": 515, "Categories": [ { "Id": "coffee_shop", "Name": "Coffee Shop", "LocalizedName": "Bar", "Primary": true } ], "BusinessChains": [ { "Name": "Starbucks", "Id": "Starbucks" } ] } ] }
cURL
curl --request POST \ --url 'https://places.geo.eu-central-1.amazonaws.com/v2/search-nearby?key=Your_Key' \ --header 'Content-Type: application/json' \ --data '{ "QueryPosition": [ 12.49563, 41.90325 ], "Filter" : { "IncludeBusinessChains": ["Starbucks"] } }'
AWS CLI
aws geo-places search-nearby --key ${YourKey} \ --query-position 12.49563 41.90325 \ --filter '{"IncludeBusinessChains": ["Starbucks"]}'

開發人員秘訣

  • 您可以使用 ExcludeBusinessChains 從結果中排除某些業務鏈。

  • 您可以排除或包含多個業務鏈。