Google地图:附近搜索参数
问题描述:
我想使用此方法获取当前城市附近的城市。我把类型局部性,但它不会返回很多结果。是否有另一种方法可以从一个地方获得最近的城市并指定半径?Google地图:附近搜索参数
https://maps.googleapis.com/maps/api/place/nearbysearch/json?type=locality&key=AIzaSyCkvow9LlFNOywy8lzaekn-xROBZRsSFvU&radius=30000&location=51.509865,%20-0.118092
答
试试这个代码:
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());
对于URL:
对于不同类型的地方看到:
是的,但是对于本地它不返回结果,对于其他类型是 –
地区不是通过谷歌支持的类型添加...你可以尝试与'城市'..上面的url显示你不同的支持的地方类型 – rafsanahmad007
它被支持https://developers.google.com/places/supported_types –