Geocoding&Reverse Geocoding
Geocoding&Reverse Geocoding
Geocoding is the process of converting addresses (like a street address) into geographic coordinates (like
latitude and longitude), which you can use to place markers on a map, or position the map.
Reverse geocoding is the process of converting geographic coordinates into a human readable address.
Geocoding is the process of finding the geographical coordinates (latitude and longitude) of a given address or location.
Reverse Geocoding is the opposite of geocoding where a pair of latitude and longitude is converted into an address or
location.
For achieving Geocode or Reverse Geocode you must first import the proper package.
import android.location.Geocoder;
The geocoding or reverse geocoding operation needs to be done on a separate thread and should never be used on
the UI thread as it will cause the system to display an Application Not Responding (ANR) dialog to the user.
To Achieve Geocode, use the below code
Geocoder gc = new Geocoder(context);
if(gc.isPresent()){
List<Address> list = gc.getFromLocationName(“155 Park Theater, Palo Alto, CA”, 1);
Address address = list.get(0);
double lat = address.getLatitude();
double lng = address.getLongitude();
}