0

我想知道如何将地理点转移到地址示例

double src_lat =30.022584 ;
        double src_long = 31.343822;
   srcGeoPoint = new GeoPoint((int) (src_lat * 1E6),(int) (src_long * 1E6)); 

我怎样才能得到这个 srcGeoPoint 的地址

4

1 回答 1

4

尝试这样的事情

            Geocoder geoCoder = new Geocoder(
                getBaseContext(), Locale.getDefault());
            try {
                List<Address> addresses = geoCoder.getFromLocation(
                    srcGeoPoint.getLatitudeE6()  / 1E6, 
                    srcGeoPoint.getLongitudeE6() / 1E6, 1);

                String add = "";
                if (addresses.size() > 0) 
                {
                    for (int i=0; i<addresses.get(0).getMaxAddressLineIndex(); 
                         i++)
                       add += addresses.get(0).getAddressLine(i) + "\n";
                }

                Toast.makeText(getBaseContext(), add, Toast.LENGTH_SHORT).show();
            } catch (IOException e) {                
                e.printStackTrace();
            }   

取自: http: //mobiforge.com/developing/story/using-google-maps-android

请参阅页面一半左右的地理编码和反向地理编码

您可能还想查看 https://developers.google.com/maps/documentation/geocoding/

于 2012-06-25T20:52:44.863 回答