Google Maps Reverse Geocoding in Java

Reverse Geocoding google map API is helpful tool (webservice) that converts given location on maps (latitude & langitude) into human readable address.

15.783 & 45.5698   ————> no:5, new street, t.nagar , Chennai -17.

Google Maps Reverse Geocoding in Java

Google Maps Reverse Geocoding in Java

Reverse Geocoding google map API (webservice) full url.

http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true_or_false

where

latlang – Latitude & Langitude value of location on maps for which we need human readable address.
sensor – Indicates whether geocode request from device with sensor.
(note : sensor parameter must be true or false in the url while requesting result)

http://maps.googleapis.com/maps/api/geocode/json?latlng=13.0810,80.2740&sensor=true

Sample JSon output for the given latlng value (13.0810,80.2740).

“formatted_address” : “Poonamallee High Road, Park Town, Chennai, Tamil Nadu, India”,
“geometry” : {
“bounds” : {
“northeast” : {
“lat” : 13.08159910,
“lng” : 80.27514250
},
“southwest” : {
“lat” : 13.08136550,
“lng” : 80.27338689999999
}
},
“location” : {
“lat” : 13.08149240,
“lng” : 80.27426340
},
“location_type” : “APPROXIMATE”,
“viewport” : {
“northeast” : {
“lat” : 13.08283128029150,
“lng” : 80.27561368029150
},
“southwest” : {
“lat” : 13.08013331970850,
“lng” : 80.27291571970849
}
}
},
“types” : [ "route" ]
},

Now we are going get the needed human readable format address from 3 pages JSON ouptut using java.

Using URL class of java reading data from the given URL. The output was JSON formated string, so we need convert the JSON formated string into JSON object using JSONSerializer class.

note: please add following needed library files in your java project to get it work without any error.

Download

Here is Java source code to get human readable format address from the given latitude & longitude value using Google maps reverse Geo-code Api.

 

 

 

Posted by:

muni

Related articles

My Favorite Blog

Quiz Web App

Responsive Quiz Application Using PHP, MySQL, jQuery, Ajax and Twitter Bootstrap

Be Happy!!!

Inspirational Quotes - Motivational Quotes- Short Stories

Does God Exists?

Inspirational Quotes - Motivational Quotes- Short Stories

Back to Top