如何将纬度和经度转换为邮政地址。我无法使用mapview来获取geopoint。我想在不使用mapview的情况下在地址中转换纬度和经度
答案 0 :(得分:0)
这称为Reverse Geocoding
,您可以使用多种服务,包括Google,Yahoo和Bing
See this article免费地理编码服务
答案 1 :(得分:0)
Android有GeoCoder
课程:
public String getAddress(double latitude, double longitude){
if (Geocoder.isPresent()) {
try {
Geocoder geocoder = new Geocoder(mContext, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocation(latitude,longitude,1);
if(addresses != null && addresses.size() > 0) {
Address first = addresses.get(0);
StringBuilder sb = new StringBuilder();
if(first.getMaxAddressLineIndex() > 0){
sb.append(first.getAddressLine(0) + ", ");
}
sb.append(first.getLocality() + ", ");
sb.append(first.getCountryName());
return sb.toString();
} catch (Exception e) {
Log.e("MyAPP", "Reverse geo lookup failed", e);
return "Unavailable"
}
} else {
return "unavailable";
}
}
答案 2 :(得分:0)
转到项目属性&gt; Android&gt;将项目构建目标设置为Google