<分区>
Possible Duplicate:
How can I find the latitude and longitude from address?
我想获取特定地址的纬度和经度。我该怎么做?
<分区>
Possible Duplicate:
How can I find the latitude and longitude from address?
我想获取特定地址的纬度和经度。我该怎么做?
最佳答案
private void getFromLocation(String address)
{
double latitude= 0.0, longtitude= 0.0;
Geocoder geoCoder = new Geocoder(this, Locale.getDefault());
try
{
List<Address> addresses = geoCoder.getFromLocationName(address , 1);
if (addresses.size() > 0)
{
GeoPoint p = new GeoPoint(
(int) (addresses.get(0).getLatitude() * 1E6),
(int) (addresses.get(0).getLongitude() * 1E6));
latitude=p.getLatitudeE6()/1E6;
longtitude=p.getLongitudeE6()/1E6;
}
}
catch(Exception ee)
{
}
}
}
关于android - 如何从Android上的地址获取经纬度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11932453/