开发者

Determine countries by gelocation (latitude and longitude)

开发者 https://www.devze.com 2023-03-21 08:02 出处:网络
I havea 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.

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
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消