0

在 ios 和其他平台上,地理编码器会返回该地址的纬度、经度和“建议半径”。

FE 如果您搜索“罗马”,它会给出一个大约城市半径作为区域半径。如果您搜索一条街道,它会给出一条较小的街道。

有没有办法使用 android sdk 获得这个半径?

4

1 回答 1

0

我遇到了同样的问题,目前 Address 对象中没有 bounds 字段。本教程应该对您有所帮助。另请参阅新的 Google 地理编码 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);
    }
于 2013-01-18T16:22:29.150 回答