我想得出输入源与放大器的基础上的路线;目的地址。我需要得到纬度/地址的基础上绘制的Android地图。所以,我怎么能得到纬度/输入地址的基础上。
地理codeR地理codeR =新的地缘codeR(getBaseContext(),Locale.getDefault());
尝试 {
名单<地址>地址=地理coder.getFromLocationName(禄,1);
字符串添加=「;
如果(addresses.size()大于0)
{
加= addresses.get(0);
}
Toast.makeText(getBaseContext(),添加,Toast.LENGTH_SHORT).show();
}赶上(IOException异常E){
Toast.makeText(getBaseContext(),e.getMessage(),Toast.LENGTH_LONG).show();
}
解决方案
使用的谷歌地理编码API来获取坐标地址:http://$c$c.google.com/apis/maps/documentation/javascript/services.html#Geocoding
I wanna draw a route on the basis of the entered source & destination address. I need to get lat/log on the basis of address to draw a map in android. So how can i get lat/log on the basis of entered address.
Geocoder geoCoder = new Geocoder( getBaseContext(), Locale.getDefault());
try {
List<Address> addresses = geoCoder.getFromLocationName("Loc",1);
String add = "";
if (addresses.size() > 0)
{
add = addresses.get(0);
}
Toast.makeText(getBaseContext(), add, Toast.LENGTH_SHORT).show();
} catch (IOException e) {
Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_LONG).show();
}
解决方案
Use the Google Geocoding API to get coordinates for an address: http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding