4
我想找到一種方法來在Android應用程序中將給定的街道地址轉換爲Google地圖的座標。任何建議請或一些鏈接閱讀有關它?將街道地址轉換爲座標android
我想找到一種方法來在Android應用程序中將給定的街道地址轉換爲Google地圖的座標。任何建議請或一些鏈接閱讀有關它?將街道地址轉換爲座標android
試試這個
Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
String textToSearch = searchText.getText().toString();
List<Address> fromLocationName = null;
fromLocationName = geocoder.getFromLocationName(texToSearch, 1);
if (fromLocationName != null && fromLocationName.size() > 0) {
Address a = fromLocationName.get(0);
GeoPoint point = new GeoPoint(
(int) (a.getLatitude() * _1E6),
(int) (a.getLongitude() * _1E6));
}
您是否嘗試過閱讀谷歌地圖API? – deb0rian