如何将gps坐标转换为Place(Google Places API)?(How to translate GPS coordinates to a place?)

我正在构建一个应用程序,该应用程序使用Google地方API在互联网启动时获取当前位置。 如果互联网关闭,我使用GPS来获取和存储坐标,当后来的互联网可用时,我想将这些坐标转换为Place(传递到API的地方)任何人都可以请帮忙吗? 我无法在需要坐标的地方API中找到任何方法。 试图将坐标转换为地点id,稍后在地方API中使用,无法做到这一点?

I'm building an app that uses Google places API to get current place if the internet is on. If the internet is off, I use the GPS to fetch and store the coordinates; when, later, the internet is available, I want to translate these coordinates to a place (pass to places API).

Can anybody, please, help?

I couldn't find any method in places API that takes coordinates. I tried to convert coordinates to place id and later use it in places API, but couldn't do it.

最满意答案

您在Places API中执行的请求需要在位置字段中输入坐标。 例如:

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

所以如果你已经有了坐标,你只需要向API发出一个请求,在这里你可以获得所有你需要的信息:

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

The request you do in Places API takes coordinates in the location field. For instance:

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

So if you already have the coordinates you should just make a request to the API, here you have all the info you need:

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

如何将gps坐标转换为Place(Google Places API)?(How to translate GPS coordinates to a place?)

我正在构建一个应用程序,该应用程序使用Google地方API在互联网启动时获取当前位置。 如果互联网关闭,我使用GPS来获取和存储坐标,当后来的互联网可用时,我想将这些坐标转换为Place(传递到API的地方)任何人都可以请帮忙吗? 我无法在需要坐标的地方API中找到任何方法。 试图将坐标转换为地点id,稍后在地方API中使用,无法做到这一点?

I'm building an app that uses Google places API to get current place if the internet is on. If the internet is off, I use the GPS to fetch and store the coordinates; when, later, the internet is available, I want to translate these coordinates to a place (pass to places API).

Can anybody, please, help?

I couldn't find any method in places API that takes coordinates. I tried to convert coordinates to place id and later use it in places API, but couldn't do it.

最满意答案

您在Places API中执行的请求需要在位置字段中输入坐标。 例如:

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

所以如果你已经有了坐标,你只需要向API发出一个请求,在这里你可以获得所有你需要的信息:

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

The request you do in Places API takes coordinates in the location field. For instance:

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

So if you already have the coordinates you should just make a request to the API, here you have all the info you need:

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