在ios和其他平台上,地理编码器返回该地址的纬度,经度和“建议半径” .
F.E.如果你搜索“罗马”,它给出一个大约半径的城市作为区域半径 . 如果您搜索单个街道,则会显示较小的街道 .
有没有办法使用android sdk获得此半径?
我遇到了同样的问题,并且Address对象中当前没有bounds字段 . This tutorial should help you.另见the new Google Geocoding API
要使用GeocoderPlus库使用Google Maps Android v2:
public void updateMapToAddress (GeocoderPlusAddress foundAddress) { LatLng addressSouthWest = new LatLng(foundAddress.getViewPort().getSouthWest().getLatitude(), foundAddress.getViewPort().getSouthWest().getLongitude()); LatLng addressNorthEast = new LatLng(foundAddress.getViewPort().getNorthEast().getLatitude(), foundAddress.getViewPort().getNorthEast().getLongitude()); LatLngBounds addressBounds = new LatLngBounds(addressSouthWest, addressNorthEast); CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(addressBounds, 0); map.animateCamera(cameraUpdate); }
1 回答
我遇到了同样的问题,并且Address对象中当前没有bounds字段 . This tutorial should help you.另见the new Google Geocoding API
要使用GeocoderPlus库使用Google Maps Android v2: