Google API for Malaysia Postcode

Here i share a api for get city and state from postcode.

http://maps.googleapis.com/maps/api/geocode/json?address=12345&region=my

Change 12345 with your postcode you want to search.

The result as below :

{
   "exclude_from_slo" : true,
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "40450",
               "short_name" : "40450",
               "types" : [ "postal_code" ]
            },
            {
               "long_name" : "Shah Alam",
               "short_name" : "Shah Alam",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Petaling",
               "short_name" : "Petaling",
               "types" : [ "administrative_area_level_3", "political" ]
            },
            {
               "long_name" : "Selangor",
               "short_name" : "Selangor",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Malaysia",
               "short_name" : "MY",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "40450 Shah Alam, Selangor, Malaysia",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 3.0765348,
                  "lng" : 101.509615
               },
               "southwest" : {
                  "lat" : 3.0622244,
                  "lng" : 101.4909253
               }
            },
            "location" : {
               "lat" : 3.0675812,
               "lng" : 101.4992343
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 3.0765348,
                  "lng" : 101.509615
               },
               "southwest" : {
                  "lat" : 3.0622244,
                  "lng" : 101.4909253
               }
            }
         },
         "place_id" : "ChIJuz5zABxSzDERzfuaHZlMFek",
         "types" : [ "postal_code" ]
      }
   ],
   "status" : "OK"
}

You may also like...

Popular Posts

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.