API : Google Maps Geo Location APIs

Most important thing is life is heading towards right directions. Now a days getting direction from google is super easy. Some times complex and difficult looking things are super simple and google Maps APIs are one of them. It is very easy to consume.

Google Maps Geocoding API web service link :

https://developers.google.com/maps/documentation/geocoding/intro#Geocoding

A Google Maps Geocoding API request must be of the following format:

https://maps.googleapis.com/maps/api/geocode/output?parameters

where output may be either of the following values:

  • json (recommended) indicates output in JavaScript Object Notation (JSON)
  • xml indicates output as XML

 

Sample get request to find location information related to Pune city in India
https://maps.googleapis.com/maps/api/geocode/json?&address=Pune%2C%20India

Sample Response :

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Pune",
               "short_name" : "Pune",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Pune",
               "short_name" : "Pune",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "Maharashtra",
               "short_name" : "MH",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "India",
               "short_name" : "IN",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "411001",
               "short_name" : "411001",
               "types" : [ "postal_code" ]
            }
         ]
}

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s