Dinesh Gurrapu Dinesh Gurrapu - 2 years ago 77
iOS Question

How to get exact City name using postal code? I am using the below API but it is not giving exact city name , It is giving only District name

This is the API that I am Using but It is giving only District name and State Name only not giving the name as per postal code. is there any another API to get exact City name. Kindly help me out from this issue.


Answer Source

A bit of a tricky one: postcode_localities is only present when the result is a postal code that contains multiple localities. However, 506366 (India) only overlaps with those localities, it does not contain any of them. That's why you won't have a locality in the address.

At the same time, there is no postal code that fully contains those locality, so you won't get a postal_code in their addresses either:

https://maps.googleapis.com/maps/api/geocode/json?&address=Parlapalle%20506366%20india https://maps.googleapis.com/maps/api/geocode/json?&address=Akinepalle%20506366%20india

Here's an example where postcode_localities is returned: 13100 (France): https://maps.googleapis.com/maps/api/geocode/json?components=country%3AFR%7Apostal_code%3A13100

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download