如何根据业务链在附近进行搜索 - Amazon Location Service

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

如何根据业务链在附近进行搜索

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

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

  • 设备位置

  • 基于知识产权的职位

  • 地图的视口中心

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

有关支持的业务链的更多信息,请参阅商业链过滤器

潜在用例

  • 探索附近的企业

  • 通过寻找附近的 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将某些业务链排除在结果之外。

  • 您可以排除或包括多个业务链。