【发布时间】:2018-10-12 06:04:52
【问题描述】:
我正在构建一个 React Native 应用程序,并且想显示特定商店的周围位置,比如说我想显示设备当前位置附近的 H&M 商店。
google 有没有为此提供的任何 API,以便您可以按商店名称、地址、邮政编码等进行搜索,并且它可以返回该地址的所有坐标和信息。
【问题讨论】:
标签: google-maps react-native google-maps-api-3 maps google-geolocation
我正在构建一个 React Native 应用程序,并且想显示特定商店的周围位置,比如说我想显示设备当前位置附近的 H&M 商店。
google 有没有为此提供的任何 API,以便您可以按商店名称、地址、邮政编码等进行搜索,并且它可以返回该地址的所有坐标和信息。
【问题讨论】:
标签: google-maps react-native google-maps-api-3 maps google-geolocation
是的。 Google 为不同的应用程序提供了很多 API。
看看https://developers.google.com/places/web-service/search
例子:
附近搜索示例
以下示例是对澳大利亚悉尼某点半径 1500m 范围内的“餐厅”类型地点的搜索请求,其中包含“巡航”一词:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=1500&type=restaurant&keyword=cruise&key=YOUR_API_KEY注意:在此示例中,您需要将密钥替换为您自己的 API 密钥,以便请求在您的应用程序中工作。
【讨论】:
Specifies the order in which results are listed. Note that rankby must not be included if radius (described under Required parameters above) is specified.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=32.715738, -117.161084&rankby=distance&keyword=Grocery store&key=YOURKEY,这对我有用