Determine countries by gelocation (latitude and longitude)
I have a list of geolocation places (given their latitud and longitude, such as 40.33,41.339), and I'd like to retrieve the countries for those geolocati开发者_StackOverflowon data.
How can I do that?. Surely there is out there a database to retrieve that information but I couldn't find anything.
Thanks in advance!
The solution is for android
Address addresses;
try {
addresses = new Geocoder(YourActivity.this,Locale.getDefault()).getFromLocation(yourLat,yourLan, 1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(!addresses.isEmpty())
{
Address addr= addresses.get(0);
// addr.getCountryName() it will give you the country
}
精彩评论