【问题标题】:How to find places near me within a specific radius如何在特定半径内找到我附近的地方
【发布时间】:2018-10-12 06:04:52
【问题描述】:

我正在构建一个 React Native 应用程序,并且想显示特定商店的周围位置,比如说我想显示设备当前位置附近的 H&M 商店。

google 有没有为此提供的任何 API,以便您可以按商店名称、地址、邮政编码等进行搜索,并且它可以返回该地址的所有坐标和信息。

【问题讨论】:

    标签: google-maps react-native google-maps-api-3 maps google-geolocation


    【解决方案1】:

    是的。 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 密钥,以便请求在您的应用程序中工作。

    【讨论】:

    • 你知道如何将它添加到反应原生应用程序中吗?或者是否有任何图书馆已经为nearBySearch做出反应
    • 看看this并在互联网上做一些关于调用api和显示数据的研究
    • 我可以从maps.googleapis.com/maps/api/place/nearbysearch/… 得到我想要的东西,但由于某种原因,rankby distance 对我不起作用,知道为什么吗?
    • 请阅读google的文档! 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,这对我有用
    猜你喜欢
    • 2011-12-28
    • 2010-10-13
    • 2013-01-08
    • 1970-01-01
    • 2021-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多