0
我想知道如何轉移的GeoPoint解決實例的GeoPoint解決
double src_lat =30.022584 ;
double src_long = 31.343822;
srcGeoPoint = new GeoPoint((int) (src_lat * 1E6),(int) (src_long * 1E6));
我怎麼能得到這個srcGeoPoint的地址
我想知道如何轉移的GeoPoint解決實例的GeoPoint解決
double src_lat =30.022584 ;
double src_long = 31.343822;
srcGeoPoint = new GeoPoint((int) (src_lat * 1E6),(int) (src_long * 1E6));
我怎麼能得到這個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-google-maps-android
請參閱地理編碼和反向地理編碼,他頁
,你可能還需要在https://developers.google.com/maps/documentation/geocoding/
'address' ......看在街道地址? –
地址或它在地圖上的位置,如「加州城市」 –