如何在特定半径内找到离我最近的地方

How to find places near me within a specific radius

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

有没有API google 提供的,这样你就可以通过商店名称、地址、邮政编码等进行搜索,并且它可以 return 所有的坐标和信息对于那个地址。

是的。 Google 为不同的应用程序提供了很多 API。

看看https://developers.google.com/places/web-service/search

示例:

Nearby search example

The following example is a search request for places of type 'restaurant' within a 1500m radius of a point in Sydney, Australia, containing the word 'cruise':

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=1500&type=restaurant&keyword=cruise&key=YOUR_API_KEY

Note: In this example, you need to replace the key with your own API key in order for the request to work in your application.