View a markdown version of this page

如何根据连锁企业在周边搜索 - Amazon Location Service

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

如何根据连锁企业在周边搜索

SearchNearby API 允许您查询附近的业务链。您可以在搜索中包含或排除特定连锁企业。此功能支持最终用户探索邻域、发现兴趣点等。

要使用 SearchNearby API,您需要提供一个 QueryPosition,它可以是:

  • 设备位置

  • 基于 IP 的位置

  • 地图的视口中心

或者,用户可以提供城市名称或地点,应用程序可以根据该位置的地理坐标对结果进行偏置。

有关支持的连锁企业的更多信息,请参阅连锁企业筛选器

潜在使用案例

  • 探索附近的企业

  • 通过寻找附近的 B2B 客户来拓展您的业务

示例

以下示例演示了如何搜索附近的星巴克门店位置。

Sample request

此请求搜索指定坐标附近的星巴克门店位置。

{ "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 将某些连锁企业排除在结果之外。

  • 您可以排除或包含多个连锁企业。