我希望使用此方法让当前城市附近的城市。我把类型局部性但它没有返回很多结果。是否有另一种方法可以从一个地方获取最近的城市并指定半径?
https://maps.googleapis.com/maps/api/place/nearbysearch/json?type=locality&key=AIzaSyCkvow9LlFNOywy8lzaekn-xROBZRsSFvU&radius=30000&location=51.509865,%20-0.118092
答案 0 :(得分:0)
试试这段代码:
StringBuilder sb = new StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json?");
sb.append("location=" + your_latitude + "," + your_longitude);
sb.append("&radius=3500"); //specify radius
sb.append("&types=" + "atm"); //specify type of place
sb.append("&sensor=true");
sb.append("&key=YOUR_API_KEY");
// Creating a new non-ui thread task to download Google place json data
PlacesTask placesTask = new PlacesTask();
// Invokes the "doInBackground()" method of the class PlaceTask
placesTask.execute(sb.toString());
代表网址:
对于不同类型的地方,请参阅: