可能的重复项:
使用谷歌地图API和PHP进行反向地理编码,以使用纬度,长坐标获取最近的位置
如何将GPS坐标(纬度和经度(转换为Android或Php上的地址?
我的程序应该从给定的坐标获取地址。例如:
坐标 : 41.011576, 28.984852 --> 地址 : 坎库尔塔兰Mh., 肯尼迪 CD, 伊斯坦布尔, 土耳其
我希望,你能帮助我。
Geocoder
类可以为Android做你想做的事。您将使用getFromLocation
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
Address adress;
String result = null;
List<Address> list = geocoder.getFromLocation(latitude, longitude, 1);
address = list.get(0);
result = address.getAddressLine(0) + ", " + address.getLocality();
//Now do what you want with result - this is the address.
您可能需要进行修改,例如,如果需要多个位置,则进行 1 英寸getFromLocation
,或者对于address.getAddressLine
,您可能希望获得多条行。
您需要将其放在try {}
块中,并在工作线程中执行此操作。
谷歌反向地理编码是你的朋友:http://code.google.com/apis/maps/documentation/geocoding/