dear friends,
i want to obtain city name in google maps if i have lat,long values of town or area? i tired using lat,long i get country but dont know how to get city name.
any help would be appriciated.
dear friends,
i want to obtain city name in google maps if i have lat,long values of town or area? i tired using lat,long i get country but dont know how to get city name.
any help would be appriciated.
You can use the Google Maps Server-side Geocoding Services, as described in the following blog article:
From a Geocoder object, you can call the getFromLocation
public List<Address> getFromLocation (double latitude, double longitude, int maxResults)
It will return a list of Address object that has a method getLocality
Geocoder gcd = new Geocoder(context, Locale.getDefault());
List<Address> addresses = gcd.getFromLocation(lat, lng, 1);
if (addresses.size() > 0)
System.out.println(addresses.get(0).getLocality());
An blog post about Geocoding in common: "Geocoding APIs for PHP, iPhone, and Android" also featuring Android