不知道您说的是不是根据地址信息获得相应的经纬度,如果是的话,我之前做的项目里面写了这样一个方法,希望能帮到您,谢谢。
**
* 根据传入的字符串获取到相应的经纬度信息
* */
public GeoPoint getGeoPointBystr(String
str) {
GeoPoint gpGeoPoint = null;
if (str!=null) {
Geocoder gc = new
Geocoder(InServeDetailActivity.this, Locale.CHINA);
List
addressList =
null;
try {
addressList =
gc.getFromLocationName(str, 1);
if (!addressList.isEmpty()) {
Address address_temp =
addressList.get(0);
//计算经纬度
double
Latitude=address_temp.getLatitude()*1E6;
double
Longitude=address_temp.getLongitude()*1E6;
System.out.println("经度:"+Latitude);
System.out.println("纬度:"+Longitude);
//生产GeoPoint
gpGeoPoint = new
GeoPoint((int)Latitude, (int)Longitude);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return gpGeoPoint;
}
如果还有问题,欢迎您继续追问。谢谢。