在给定距离的情况下获取位置周围的地方

Get places around location given a distance

既然Google换了地方API那么我觉得这道题就不再是之前题目的重复了

在 Android,我对检索人员位置 20 公里以内的医院地点很感兴趣。

当我检查 Android Places SDK (https://developers.google.com/places/android-sdk/current-place) 然后我看到他们有 "getCurrentPlace" 但这不允许我指定距离而且它似乎只是 return 当前位置!

但是,webAPI 似乎提供了更多控制权,但我不确定是否规范是在 Android app.

中使用 web api

许多网站都在谈论使用地理编码 api 来获取位置,但这没有意义,因为 api 可以进行转换,但不知何故它正在获取位置。

所以我很困惑,我需要 do/use 什么才能满足我的要求?

谢谢

我曾经写过一个应用程序找不到这个所以这样使用:

StringBuilder builder = new StringBuilder();
builder.append("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=")
        .append(mLocation.getLatitude())
        .append(",")
        .append(mLocation.getLongitude())
        .append("&radius=")
        .append(radius)
        .append("&types=restaurant&sensor=true&key=AIzaSyC4BuDhg8b384A5VXCVooPLwiOeKWEC31M");

只需在其上使用 toString() 然后请求 GET 您将在 json 中获得一个数组并使用它执行您需要的操作。