GeoPoint的解决GeoPoint

2023-09-08 08:50:03 作者:青春是场偶遇相见不散i

我想知道如何转移的GeoPoint解决示例

i want to know how to transfer geopoint to address Example

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

我怎么能得到这个srcGeoPoint的地址

how can i get the address of this srcGeoPoint

推荐答案

尝试这样的事情

            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 - 谷歌 - 地图 - 机器人

看地理编码和反向地理编码中途上下左右页

see geocoding and reverse geocoding about halfway down the page

您可能也想看看 https://developers.google.com/maps/文档/地理编码/