我想知道如何将geopoint转移到地址示例
double src_lat =30.022584 ;
double src_long = 31.343822;
srcGeoPoint = new GeoPoint((int) (src_lat * 1E6),(int) (src_long * 1E6));
如何获取此srcGeoPoint的地址
答案 0 :(得分: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/