Geocoding and Reverse Geocoding in Android

Download source code of the article.

Geocoding is the process of finding geographic location from location name, zip codes, etc… Reverse Geocoding is the process of finding location name and other information from geographic location. In Android there is a class Geocoder which handles Geocoding and Reverse Geocoding. This class has three methods: getFromLocation, getFromLocationName and a variant of getFromLocationName.

The method getFromLocation is used to reverse geocode and the method getFromLocationName is used to geocode. The getFromLocation method accepts 3 parameters: latitude, longitude and maximum number of results to return.

There are 2 variants of the method getFromLocationName. Both accept location name and maximum number of results to return. The first variant accepts additional four parameters. These are the longitude and latitude of the bounding rectangle for the search results. If you specify these parameters, the Geocoder will only search within the bounding rectangle, i.e. the results outside the bounding rectangle will not be included in the results.

These functions return a list of Address class which represents the result of the query.

The sample provided is a simple one to demonstrate the use of this class, hope this will help you to start geocoding.

6 Responses

  1. mauricio August 15, 2010 / 7:19 pm

    You did a great great job. Thanks for sharing us.

  2. mauricio August 16, 2010 / 12:49 am

    You did a great great job. Thanks for sharing us.

  3. MJ March 28, 2011 / 4:37 pm

    Thank you so much. Your exif sample was really helpful.
    Keep up the effort!.
    PS – It would be nice if you could add a bit of explanation in either your code or in your blog post about the code, what its doing and why you did like this etc.

    Thanks again for the great effort!!

Leave a Reply

Your email address will not be published. Required fields are marked *