Reputation: 217
i want to know how to transfer geopoint to address Example
double src_lat =30.022584 ;
double src_long = 31.343822;
srcGeoPoint = new GeoPoint((int) (src_lat * 1E6),(int) (src_long * 1E6));
how can i get the address of this srcGeoPoint
Upvotes: 0
Views: 2792
Reputation: 66
Try something like this
Geocoder geoCoder = new Geocoder(
getBaseContext(), Locale.getDefault());
try {
List<Address> addresses = geoCoder.getFromLocation(
srcGeoPoint.getLatitudeE6() / 1E6,
srcGeoPoint.getLongitudeE6() / 1E6, 1);
String add = "";
if (addresses.size() > 0)
{
for (int i=0; i<addresses.get(0).getMaxAddressLineIndex();
i++)
add += addresses.get(0).getAddressLine(i) + "\n";
}
Toast.makeText(getBaseContext(), add, Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
}
taken from: http://mobiforge.com/developing/story/using-google-maps-android
see geocoding and reverse geocoding about halfway down the page
you might also want to look at https://developers.google.com/maps/documentation/geocoding/
Upvotes: 4